Hi All,

Can somebody explain me this behaviour? The output of the code below gives
me null. When I ran it through the Debugger I found that the String version
of method is executed. But why isn't the object version not executed? How
does the compiler decide this ?

class Test
{
    public static void main(String[] args)
    {
        Test test = new Test();
        test.method(null);
    }
    void method(String str)
    {
        System.out.println(str);
    }
    void method(Object obj)
    {
        System.out.println(obj);
    }
}

Regards,
Babu

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to