我在java中有一个类。这个类有像波纹管我怎样才能定义一个默认的构造函数,而我有其他的构造函数?
public Person(String first, String last) {
firstName = new SimpleStringProperty(first);
lastName = new SimpleStringProperty(last);
city = new SimpleStringProperty("Tehran");
street = new SimpleStringProperty("Vali Asr");
postalCode = new SimpleStringProperty("23456");
birthday = new SimpleStringProperty("12345");
}
现在我要声明构造像波纹管
public Person() {
Person(null, null);
}
一个构造函数,但它给我的错误。 我该怎么办? 感谢
你会得到什么错误? –
改为使用'this(null,null)'。 – Linuslabo