Single Choice Easy

QHow does inheritance in Java differ from inheritance in C++?

ID: #10340 Abstract class and method 147 views
Question Info
#10340Q ID
EasyDifficulty
Abstract class and methodTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A In Java, multiple inheritance is supported, while in C++ it is not.
  • B In C++, multiple inheritance is supported, while in Java it is not.
  • C In Java, all classes inherit from a common superclass, while in C++ they do not.
  • D In C++, classes can have multiple levels of inheritance, while in Java they cannot.
Correct Answer

Explanation

In Java, multiple inheritance is supported, while in C++ it is not. This means that a class in Java can inherit from multiple classes, while in C++ a class can only inherit from one class. In addition, in Java all classes inherit from a common superclass, while in C++ they do not. Furthermore, in C++ classes can have multiple levels of inheritance, while in Java they cannot.

Share This Question

Challenge a friend or share with your study group.