Aşağıdaki örnekte, 2 kurucu var: bir String alan ve özel bir nesne alan bir. Bu özel nesnede, bir String döndüren bir "getId()" yöntemi vardır.Boş bırakılırken hangi kurucu seçilir?
public class ConstructorTest {
private String property;
public ConstructorTest(AnObject property) {
this.property = property.getId();
}
public ConstructorTest(String property) {
this.property = property;
}
public String getQueryString() {
return "IN_FOLDER('" + property + "')";
}
}
Kurucuya null iletirseniz, hangi kurucu seçilir ve neden seçilir? Benim testimde String kurucu seçildi, ancak bunun her zaman böyle olup olmayacağını bilmiyorum.
Umarım birileri bana bu konuda biraz bilgi verebilir.
Şimdiden teşekkürler.
Haklısın, testimde bir hata yaptım, bu yüzden derleyici hatası ortaya çıkmadı. –
döküm, kim bilir! –
link is death; ( – OneWorld