- A Class A method
- B Class B method
- C Compilation Error
- D Runtime Error
Java Programming Language MCQ Overriding and Overloading in Java
⚠ Report ✓ Question Verified Copy Link
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();
}
}
Learn More MCQ Questions from Java Programming Language MCQ Overriding and Overloading in Java