先上代码
public class CustomerTest {
public static void main(String[] args) {
Customer c1 = new Customer();
c1.name = "zhangsan";
System.out.println(c1.name);
c1.shopping();
//
Customer c2 = new Customer();
c2.name = "lisi";
System.out.println(c2.name);
c2.shopping();
Customer.doSome();
Customer.doOther();
}
}
public class Customer {
String name;
public Customer(){
}
public void shopping(){
System.out.println(name+"在购物");
System.out.println(this.name+"在购物");
}
public static void doSome(){
}
public static void doOther(){
Customer c = new Customer();
System.out.println(c.name);
}
}