Multiple choice

Select a valid answer with respect to the following piece of code. class A {
int value1; } class B extends A {
int value2; }

  1. Class A extends class B.

  2. Class B is superclass of class A.

  3. Class A inherits from class B.

  4. Class B is subclass of class A.

  5. Class A is subclass of class B.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

This is the correct answer. As class B is extending from class A, hence class A is the superclass and class B is the subclass.