Possible Duplicate:
Understanding which constructor is chosen and why
Why compiler acts like this,
public class Calculator{
private Calculator(Object o) {
// code goes here
}
private Calculator(double[] calc) {
// code goes here
}
public static void main(String[] args) {
new Calculator(null);
}
}
This program executes second constructor. Why first constructor not execute?
Both constructors are accessible and applicable.
The constructor Calculator (Object) accepts any parameter passed to Calculator (double[]), so Calculator (Object) is less specific.