1. abstract class C1{ public void m1(){ //1 }} abstract class C2{ public void m2(){ //2 }}
  1. compile time error at line1

  2. compile time error at line2

  3. The code compiles fine

  4. None of the above


Correct Option: C

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) compile time error at line 1 - This option is incorrect. There is no compile-time error at line 1. The code defines an abstract class called C1 and declares a method m1() in it. The method does not have a body (implementation) because it is marked as abstract. This is allowed in Java for abstract methods.

Option B) compile time error at line 2 - This option is incorrect. There is no compile-time error at line 2. The code defines another abstract class called C2 and declares a method m2() in it. Similar to the previous class, this method is also marked as abstract and does not have a body.

Option C) The code compiles fine - This option is correct. The code compiles without any errors. Both abstract classes, C1 and C2, are defined correctly, and their abstract methods are declared without any issues.

Option D) None of the above - This option is incorrect. The correct answer is option C, as explained above.

The correct answer is C) The code compiles fine. This option is correct because there are no compilation errors in the given code.

Find more quizzes: