Which, inserted at line 2 in Test.java, allows the code to compile?

Given two complete source files:
1. /* Example.java */
2. package pack;
3. public class Example { }
1. /* Test.java */
2. // insert code here
3. public class Test {

4. public static void main(String args[]) {
5. Example obj = new Example();
6. }
7. }
Which, inserted at line 2 in Test.java, allows the code to compile?

Given two complete source files:
1. /* Example.java */
2. package pack;
3. public class Example { }
1. /* Test.java */
2. // insert code here
3. public class Test {

4. public static void main(String args[]) {
5. Example obj = new Example();
6. }
7. }
Which, inserted at line 2 in Test.java, allows the code to compile?

A.
import pack;

B.
The code compiles with no changes.

C.
import pack.Test;

D.
import pack.Example;



Leave a Reply 0

Your email address will not be published. Required fields are marked *