What is the result of the following code compilation and execution?

class A {
    private static void test1() { 
        System.out.println("A.test1");
    } 
    
    static void test2() {
        test1();
    } 
} 

public class B extends A { 
    void test1() {
        System.out.println("B.test1");
    } 
    static void test2() {
        super.test2();
    } 
    public static void main(String[] args) { 
        A a = new B(); a.test2(); 
    }
}

Follow CodeGalaxy

Mobile Beta

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