import java.util.ArrayList;
public class pingpang {
String a,b,c;
public static void main(String[] args) {
String[] op = { "x", "y", "z" };
ArrayList<pingpang> arrayList=new ArrayList<pingpang>();
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
for (int k = 0; k < 3; k++) {
pingpang a=new pingpang(op[i],op[j],op[k]);
if(!a.a.equals(a.b)&&!a.b.equals(a.c)&&!a.a.equals("x")
&&!a.c.equals("x")&&!a.c.equals("z")){
arrayList.add(a);
}
}
for(Object a:arrayList){
System.out.println(a);
}
}
public pingpang(String a, String b, String c) {
super();
this.a = a;
this.b = b;
this.c = c;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return"a的对手是"+a+","+"b的对手是"+b+","+"c的对手是"+c+"\n";
}
} |