これは私が書いた住所情報を保持するコンストラクターですが、名前、住所、都市、州の郵便番号を保持する文字列を返さなければならない最後の部分に問題があります。どのように書くのが正しいでしょうか?
パブリック クラス アドレス {
private String name;
private String address;
private String state;
private String city;
private String zipcode;
public Address(String name, String address, String state, String city, String zipcode){
this.name = name;
this.address = address;
this.state = state;
this.city = city;
this.zipcode = zipcode;
}
public Address(){
name = "occupant";
address = " ";
state = " ";
city = " ";
zipcode = " ";
}
public void setAddress(String Address){
this.address = Address;
}
public void setstate(String state){
this.state= state;
}
public void setcity(String city){
this.city = city;
}
public void setzipcode(String code){
this.zipcode = code;
}
public String getaddress(){ // Return string that contains name and address and city and zipcode
return getaddress() + " " + return state + " " + return city + " " + return code;
}
}