Important Java Mcq 1

Which of the following is true regarding Java classes?

public class Test {
        java.util.Date.date;
        public static void main(String[] args) {
          Test test = new Test();
          System.out.println(_______);  
      }
   } 

a. All classes must have 1 parent but may have many any number of children classes.

b. All classes must have 1 child class but may have any number of parent classes.

c. All classes must have 1 parent class and may have a single child class.

d. All classes can have either 0 or 1 parent class and any number of children classes.

Answer:

a. All classes must have 1 parent but may have any number of children classes.

Explanation

The above answer leads to a concept called inheritance where there should be at least one parent class and from that class, many child classes can be derived.

Related MCQs
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?