請不帶任何參數裏面的意思有被定義了多個參數解釋超級構造函數的Java
public class Contact {
private String contactId;
private String firstName;
private String lastName;
private String email;
private String phoneNumber;
public Contact(String contactId,String firstName, String lastName, String email, String phoneNumber) {
super(); //what does standalone super() define? With no args here?
this.firstName = firstName;
this.lastName = lastName; //when is this used?, when more than one args to be entered?
this.email = email;
this.phoneNumber = phoneNumber;
}
超()?這是在「this.xxx」的幫助下完成的嗎?
爲什麼我們在「公共類聯繫人」本身中定義。爲什麼我們再次定義並在此提出它的論點?
super在你的情況下調用父類構造函數,Object類構造函數 – ant 2011-01-13 09:55:09