What will happen as a result of the following code?

class A {}
class B extends A {}

public class Test { 
    static public  void main(String args[]) {
        B b = new B();
        A a = b;
        if (a.hashCode() == b.hashCode())
            System.out.print("Passed");
    }
}

Follow CodeGalaxy

Mobile Beta

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