Single Choice Not Set

QWhat will be the output?
class A{
	static void method(){
		System.out.println("Class A method");
	}
}
class B extends A{
	static void method(){
		System.out.println("Class B method");
	}
}
public class Test{
	public static void main(String args[]){
		A a = new B();
		a.method();
	}
}

ID: #2231 Overriding and Overloading in Java 936 views
Question Info
#2231Q ID
Not SetDifficulty
Overriding and Overloading in JavaTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A Class A method
  • B Class B method
  • C Compilation Error
  • D Runtime Error
Correct Answer

Explanation

Class A method

Share This Question

Challenge a friend or share with your study group.