Which modification enables the code to compile?

Given the code fragments:
A.java:
package pi; public class A {
}
B.java:
package pl.p2;
//line nl public class B {
public void doStuff() {
A b = new A () i
}
}
C.java:
package p3;
//line n2 public class C {
public static void main(String[] args) { A o1 = new A(};
B o2 = new B(};
>}
Which modification enables the code to compile?
A. Replace line n1 with: import p1 .A;
Replace line n2 with: import p1 .A; import p1 .p2.B;
B. Replace line n1 with: import p1;
Replace line n2 with: import p1 ; import p1 ,p2;
C. Replace line n1 with: import p1 .A;
Replace line n2 with: import p1
D. Replace line n1 with: import p1
Replace line n2 with: import p1 .p2.*;

Download Printable PDF. VALID exam to help you PASS.

4 thoughts on “Which modification enables the code to compile?

  1. A :
    to compile this program successfully inside folder with C.java it is needed to create p1 and p1/p2 subfolders and move A.java and B.java respectively to these folders, then compilation will be without errors:

    # javac C.java

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.