package final0;
/*
* 顾客
*/
public class Customer {
// 属性
String name;
int age;
// 父类object的方法
public Customer() {
super();
}
// 父类有参的构造方法
public Customer(String name, int age) {
this.name = name;
this.age = age;
}
}
-----------------------------------------------------
package final0;
public class TestFinal0 {
public static void main(String[] args) {
final Customer c = new Customer("vv", 11);
// 此处final修饰的地址不能被修改
// c=new Customer();
c.age = 10;
c.name = "w";
System.out.println(c);
System.out.println(c.age);
System.out.println(c.name);
}
}