public class shuffle1 {
public static void main(String[] args) {
int x = 3;
while (x > 0) {
if (x == 3) {
System.out.print("a");
}
;
if (x == 2) {
System.out.print("b c");
}
;
x = x - 1;
System.out.print("-");
if (x == 1) {
System.out.print("d");
x = x - 1;
}
;
}
}
}
代码改了 你看一下,你的if放在了循环外面 永远不会被执行。