What will be the result of the following code compilation and execution?

public class Main { 
  public static void main(String args[]) {
     ClassA a = new ClassA();

class ClassA {
    public void methodA(){
        ClassB classB = new ClassB();
class ClassB {
    public ClassC classC;
    public String getValue() {
        return classC.getValue();
class ClassC {
    public String value;
    public String getValue() {
        value = "ClassC";
        return value;

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Sign Up Now
or Subscribe for future quizzes