我已经编写了一个代码,每当我尝试对其进行测试时,我都会收到一条错误消息:
"StreetAddress.java:62: missing return statement
}"
这是代码:
public class StreetAddress
{
private String myStreet;
private String myCity;
private String myState;
private String myZip;
public StreetAddress( String street, String city, String state, String zip )
{
myStreet = street;
myCity = city;
myState = state;
myZip = zip;
}
public void setStreet( String street )
{
myStreet = street;
}
public String getStreet()
{
return myStreet;
}
public void setCity( String city )
{
myCity = city;
}
public String getCity()
{
return myCity;
}
public void setState( String state )
{
myState = state;
}
public String getState()
{
return myState;
}
public void setZIP( String zip )
{
myZip = zip;
}
public String getZIP()
{
return myZip;
}
public String mailingLabel()
{
System.out.println( getStreet() );
System.out.println( getCity() + ", " + getState() + " " + getZIP() );
}
}
}
我不知道哪里缺少 } 我检查了我的代码好几次。请帮忙!