package test; public class hello { public static void main(String [] argv) { char a1= '+' , a2='点' ,a3='进',a4='攻'; char secret ='A'; int n=2; while(n--!=0) //此处不能光用n-- ,会提示没有Boolean匹配 { a1 = ( char ) (a1^secret); a2= ( char ) (a2^secret); a3= ( char ) (a3^secret); a4= ( char ) (a4^secret); System.out.println("密文:"+a1+a2+a3+a4); } } }