标签:方法 代参 myshopping
package com.wxws.sms; public class Customer { int No; int integarl; } package com.wxws.sms; public class Customers { Customer[] customers = new Customer[100]; public void add(Customer cust){ for (int i = 0; i <customers.length; i++) { if (customers[i]==null) { customers[i]=cust; break; } } } public void show(){ System.out.println("会员列表*****"); for (int i = 0; i <customers.length; i++) { if (customers[i]!=null) { System.out.print(customers[i].No+"\t"+customers[i].integarl+"\t"); } } } } package com.wxws.sms; import java.util.Scanner; public class Test { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner (System.in); Customer A = new Customer(); Customers B = new Customers(); System.out.print("请输入会员编号:"); A.No=in.nextInt(); System.out.print("请输入会员积分:"); A.integarl=in.nextInt(); B.add(A); B.show(); } }
java-第十四章-代参的方法(二)-实现MyShopping系统的添加会员功能,布布扣,bubuko.com
java-第十四章-代参的方法(二)-实现MyShopping系统的添加会员功能
标签:方法 代参 myshopping
原文地址:http://wenwen520.blog.51cto.com/8956560/1427019