But how could you ever say that the overloaded method will not be overridden in the subclasses.
Let's say:
public class A{
int x(
String s){...}
int x(int i){...}
void x (String s, int i){}
....
....
}
public class B extends A{
int x(String s){...}
int x(int i){...}
void x (String s, int i){}
......
....
}
class Client {
public static void main(String []args){
A a= new B();
a.x("java");
}
}
In this case looking at class A alone which does not no that it has a sub class and the class Client uses a class A reference and calls a method x.
Now how could this be resolved at compile time.