1. Program will compile and execute successfully and prints
  2. Compilation error as class can not be declared as abstract.
  3. Program compiles but leads to runtime exception.
  4. Compilation error occurs as the abstract class TestAbstract contains a non-abstract method.
  5. None of these
6 views

1 Answers

Answer: Option 1

The options B, C and D are incorrect options as in Java we can declare an abstract class comprising of abstract and non-abstract methods that will not lead to any compilation error. Therefore, option A is the correct answer implying that the 't' instance of Test class invokes the display method, which is implemented in the Test class. The display method invokes myName() method declared int the TestAbstract class and prints the name.

6 views

Related Questions