Kiran Kumar
Posts: 12
Nickname: k3
Registered: May, 2007
|
|
something
|
Posted: May 29, 2007 4:33 AM
|
|
|
Advertisement
|
Hi
Can any one help me in understanding this concept.
<java>
class A{} class B extends A{}
class SomeThing{
void meth1( A a ){ System.out.println("Inside A"); } void meth1( B b ){ System.out.println("Inside B"); }
public static void main( String []args ){ SomeThing t = new SomeThing(); t.meth1( null ); } }
</java>
And this method call of "meth1( null )" in the main method calls the "meth1( B b )". Why?
I know that any method call with a null as argument calls the most specific overloaded method. But why?
Kindly provide me with an answer.
Regards Kiran
|
|