源程序:
class Address{
String country ;
String province ;
String city ;
String street ;
String code ;
public Address(String country , String province , String city , String street , String code ){
this.country = country ;
this.province = province ;
this.city = city ;
this.street = street ;
this.code = code ;
}
public void print(){
System.out.println(this.country + "
" + this.province + "
" + this.city + "
" + this.street + "
" + this.code) ;
}
}
public class Test{
public static void main(String[] args){
Address ad = null ;
ad = new Address("中国" , "陕西" , "兴平" , "西城" , "713100") ;
ad.print() ;
}
}
运行结果: