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();
     a.methodA();
  } 
}

class ClassA {
    public void methodA(){
        ClassB classB = new ClassB();
        System.out.println(classB.getValue());
    }
}
  
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