Menu
Topics Index
...
`

Class Inheritance Correct Statements


If you need explanation Read this topic

If you need Answer Take test on this topic

Class Inheritance Correct Statements
Given the following class hierarchy:
class A
{
}

class B extends A
{
}
Which of the following statements is true.

X. Every B object is also an A object.
Y. Every A object is also a B object.
A. X and Y
B. X only
C. Y only
D. Neither X nor Y
Topic: Is-A Relationship In Java

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

ANS IS B ( X Only)....here inheritance is used..class B Extends Class A I.e. every object of B is also an object of cass A.

Posted by Mânïshå Mùlchåndânï    2015-01-07 08:39:41


B only x. B can call the object from   A. Here inheritance topics will extends.

Posted by Fuzail Ahmed    2015-01-07 09:33:18


b.is right answer

Posted by Shubham Bansal    2015-01-07 09:42:04


B

Posted by Deion Davis    2015-01-07 10:08:11


ans b.Every sub-class object is also a super-class object, but every super-class object need not be a sub-class object. here class B extends A,so Every B object is also an A object----X only

Posted by Maheshwari Natarajan    2015-01-07 11:41:50


ans is B as this concept is based on inheritance  in inheritance properties of class A ie super class are extended by the class B ie sub class  so from this every object of B is also an object of A ie if u create an object for B then it can also be used for class A

Posted by Ramya Reddy Addulla    2015-01-07 12:57:40


Ans is B..here we have the Inheritance concept which means Child class will inherit the properties(Methods & attributes) of the Parent class..so when we create the instance for the Child class than the memory will allocate for the Parent class variables and when we create the instance for the child class Parent class Constructor also get invoked so Every Object is A object..

Posted by Uday Kumar    2015-01-07 16:22:56


This dose is now closed and the winners are Mânïshå Mùlchåndânï,  for 'First Correct Comment', Maheshwari Natarajan, Ramya Reddy Addulla, Uday Kumar,  for 'Best Comment' and Uday Kumar for the 'Popular Comment'. The 'lucky liker' is Shubham Bansal. Please login into Merit Campus using facebook, to claim your recharge. Go to http://java.meritcampus.com/earnings to raise the recharge.

Posted by Merit Campus    2015-01-09 02:35:07


© meritcampus 2019

All Rights Reserved.

Open In App