1. package test1; 2. public class Test1 { 3. static int x = 42; 4. } 1. package test2; 2. public class Test2 extends test1.Test1 { 3. public static void main(String[] args) { 4. System.out.println(“x = “ + x); 5. } 6. } What is the result?
  1. Compilation fails because of an error in line 2 of class Test2.

  2. x = 42

  3. Compilation fails because of an error in line 3 of class Test1.

  4. Compilation fails because of an error in line 4 of class Test2.


Correct Option: A

Find more quizzes: