Considering the java code below:
class Enclosing {
void method(){}
void method(String str){}
class Inner {
void method(){}
}
}
I am reading a book which tells me that Inner.method() will hide both versions of Enclosing.method(), which means it is an error if I call method(aString) somewhere in class Inner.
Why is the language designed like that?
Update:
According to the answer given by @Debosmit Ray, it is related to shadowing. I have read the docs and understood what it is.
What still confusing me is why method shadowing is based on method name not method signature?