What is the result?

Given:
public class ClassA {
public void methodA() {
ClassB classB = new ClassB();
classB.getValue();
}
}
class ClassB {
public ClassC classC;
public String getValue() {
return classC.getValue();
}
}
class ClassC {
public String value;
public String getValue() {
value = "ClassB";
return value;
}
}
and:
ClassA a = new ClassA();
methodA();
What is the result?
A. Compilation fails.
B. ClassC is displayed.
C. The code runs with no output.
D. An exception is thrown at runtime.

Download Printable PDF. VALID exam to help you PASS.

Leave a Reply

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


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