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