首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

java 标题 编写一个代表地址的Address类,地址信息由国家,省份,城市,街道,邮编组成,并且可以返回完整的地址信息!并用测试类 进行测试

2011-12-10 
java题目编写一个代表地址的Address类,地址信息由国家,省份,城市,街道,邮编组成,并且可以返回完整的地址信

java 题目 编写一个代表地址的Address类,地址信息由国家,省份,城市,街道,邮编组成,并且可以返回完整的地址信息!并用测试类 进行测试!
请高手给于程序案例!

[解决办法]
纯数据类,没什么需要测试的。

Java code
public final class Address {    public final String country;    public final String province;    public final String city;    public final String street;    public final String postcode;    public Address(String country,String province,String city,String street,String postcode){        this.country = country;        this.province = province;        this.city = city;        this.street = street;        this.postcode = postcode;    }    @Override String toString(){        return String.format("Address[country:%s, province:%s, city:%s, street:%s, postcode:%s]",country,province,city,street,postcode);    }} 

热点排行