创建Customer.java
/***
* 需求分析:创建客户类
* @author chenyanlong
* 日期:2017/10/15
*/
package com.hp.test06; public class Customer {
int points;//积分
String cardType;//卡类型 //显示信息
public void show(){
System.out.println("积分"+points+",卡类型:"+cardType);
}
}
InitialCustomer.java
/***
* 需求分析:测试Customer
* @author chenyanlong
* 日期:2017/10/15
*/
package com.hp.test06; public class InitialCustomer { public static void main(String[] args) {
// TODO Auto-generated method stub
Customer customer=new Customer();
customer.points=1000;
customer.cardType="会员卡";
customer.show();
} }
运行InitialCustomer.java,结果为