Hello,
Good morning to all.In my class has a 2 constructor with one argument,in which one constructor argument is object and then another constructor argument is string.At this synario i create a instace for that class pass null argument.Which one is excute.
I'm getting the answer is
String argument.
Why the Object argument doesn't excute the first, cause Object all for the base class.
What is reason
Even as i wrote this sample code as well
-----------------
class sample
{
sample(Object o)
{
System.out.println("Object");
}
sample(String o)
{
System.out.println("String");
}
}
class constructor
{
public static void main(String arg[])
{
sample s1=new sample(null);
}
}
regards
rex