Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Inheritance represents what type of relationship? Flag this Question Question 2

ID: 3840828 • Letter: I

Question

Inheritance represents what type of relationship?

Flag this Question

Question 2 1 pts

What is the keyword used to indicate a class inheritance relationship?

Flag this Question

Question 3 1 pts

A sub class may not access any private members of the super class by name.

Flag this Question

Question 4 1 pts

What is the keyword used by a sub class to call a super class constructor?

Flag this Question

Question 5 1 pts

When we implement the method: String toString() {} in our classes, we are ______ the method from the Object class.

Is-A

Explanation / Answer

Ans : (1 ) In an object oriented programming langauge Inheritence represents IS-A type relationship. It descibes the inheritence methodology . IS -A relationship means one or more classes are the subclasses of the parent class i,e

Example : ClassB extends ClassA which means ClassB IS -A subclass of ClassA.

Hence, the keyword used to represent class inherirence relationship is - IS- A.

Ans (2) True : As to access the private members of the super class by name , the keyword used is Super()

Super() is used to invoke the immediate parent class constructor.

Ans(3) When we implement the method String to string() in our classes ,we are overriding the method from object class.

The java.lang package has many classes defined in it. Every class is the part of object directly or indirectly.Every class used inherits the instance methods of Object therefore whenever we use any of these methods,we need to override them.The tostring() method returns the string representation of the object.