💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
编写并测试一个代表地址的Address类,地址信息由国家、省份、城市、街道、邮编组成,并可以返回完整的地址信息。 ```java //地址类 public class Address{ private String country; private String province; private String city; private String street; private int zipcode; public Address() {} public Address(String country,String province,String city,String street,int zipcode) { this.country=country; this.province=province; this.city=city; this.street=street; this.zipcode=zipcode; } public String getInfo() { return "国家:"+this.country+"、省份:"+this.province+"、城市:"+this.city+"、街道:"+this.street+"、邮编:"+this.zipcode; } public void setCountry(String country) { this.country = country; } public void setProvince(String province) { this.province=province; } public void setCity(String city) { this.city=city; } public void setStreet(String street) { this.street=street; } public void setZipcode(int zipcode) { this.zipcode=zipcode; } public String getCountry() { return this.country; } public String getCity() { return this.city; } public String getProvince() { return this.province; } public String getStreet() { return this.street; } public int getZipcode() { return this.zipcode; } } //测试类 public class Test { public static void main(String args[]) { System.out.println(new Address("中国","北京","直辖市","朝阳",60000).getInfo()); } } ```