十四章上機練習2
package shisi14; import java.util.Scanner; public class shangji2 { Scanner input=new Scanner(System.in); String []names=new String[5]; public void addName(String name){//999 for(int i=0;i<names.length;i++){ if(names[i]==null){ names[i]=name; break; } } } public boolean editname(String oldName,String newName){ boolean find =false ; for(int i=0;i<names.length;i++){ if(names[i].equals(oldName)){ names[i]=newName; find=true; break; } } return find; } public void show(){ for(int i=0;i<names.length;i++){ System.out.println("客戶姓名:"+names[i]); } } }
package shisi14;
import java.util.Scanner;
public class shangji2 {
Scanner input=new Scanner(System.in);
String []names=new String[5];
public void addName(String name){//999
for(int i=0;i<names.length;i++){
if(names[i]==null){
names[i]=name;
break;
}
}
}