I am having a situation where sometimes the parameter sent to instantiate one of my classes is null. It is not, howver , calling the constructor I thought it would call. So, I made a test case and sure enough I am not getting what I thought.
public class MyClass
{
private MyClass()
{
System.out.println("No param sent");
}
private MyClass(Object o)
{
System.out.println("Object");
}
private MyClass(double[] dArray)
{
System.out.println("double array");
}
public static void main(String[] args)
{
new MyClass(null);
}
}
I thought it would call the constructor that has no signature but it appears to call the double[] dArray constructor.