Class A
has run()
method and interface B also has run()
method. Question is simple, which run()
method is overridden in Main
class and how will we prove this? Why there is no conflict (Compile-time error) in this code?
class A{
void run(){System.out.println("A class");}
}
interface B{
void run();
}
class Main extends A implements B{
public static void main(String args[]){
Main m = new Main();
m.run();
}
// Overridding method
public void run(){
System.out.println("run method");
}
}