An Inheritance issue

Which of the following deductions can be made from the code snippet given below?

class A
{
{
System.out.println(1);
}
}
class B extends A
{
{
System.out.println(2);
}
}
class C extends B
{
{
System.out.println(3);
}
}
 
class D extends B
{
{
System.out.println(4);
}
}
Options
  1. Class A is the only child of class C because it comes after class B and therefore overrides it
  2. Class B is a child for two different classes
  3. Class B is a parent to both classes C and D
  4. Class C is only a parent to class B
  5. Class D is a child of class A because it is underneath it

Related Posts

Close Bitnami banner
Bitnami