Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming language is JAVA: Study the code below and say which combinations of

ID: 3830762 • Letter: P

Question

Programming language is JAVA:

Study the code below and say which combinations of A, B, C, D we can uncomment without a generating a compiler error. (Assume the two classes are in separate files.)

------------------------------------------------

public class Foo {

// public Foo() {} /* A */

// public Foo(int n) {} /* B */

}

--------------------------------------------------

public class Tester {

public static void main(String [] args) {

// Foo c1 = new Foo(); /* C */

// Foo c2 = new Foo(5); /* D */

}

}

---------------------------------------------------

Explanation / Answer

Answer: Below are the combinations we can uncomment without a generating a compiler error

A and C

B and D