标签:tom delete lse print code pre system ++ turn
1 public boolean deleteCustomer(int index){ 2 boolean ret=false; 3 if(index<total && index>=0){ 4 if(customers[index].getName()!=null){ //以name作为此位置是否有Customer的判断条件 5 if(index==9){ 6 customers[9].setName(null); 7 ret=true; 8 }else if(customers[index+1].getName()==null){ //适用于要删除的Customer在列表末尾 9 customers[index].setName(null); 10 ret=true; 11 }else{ 12 int i=0; 13 for (i=0; index+i<total; i++) { 14 if((index+i)==9){ 15 customers[index+i]=new Customer(); 16 }else{ 17 customers[index+i]=customers[index+i+1]; 18 if(customers[index+i+1].getName()==null){ 19 break; 20 } 21 } 22 } 23 ret=true; 24 } 25 } 26 }else{ 27 System.out.print("选择错误,请重新输入:"); 28 } 29 return ret; 30 }
标签:tom delete lse print code pre system ++ turn
原文地址:https://www.cnblogs.com/hirasawayui/p/13138498.html