Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardJavaclass loading delegationSingle-choice MCQ

What does this code print?

class A { static int test() { return 1; } }\nclass B extends A { static int test() { return 2; } }\nclass C extends B { static int test() { return 3; } }\nC obj = new C();\nSystem.out.println(obj.test());