class test{
public static void main(String[] args){
int x = 3;
if (x > 2) {
System.out.print("a");
}while (x > 0) {if (x == 2) {
System.out.print("b c");
}
x = x - 1;
System.out.print("-");if (x == 1) {
System.out.print("d");
x = x - 1;
}
}
}
}为什么输出是a-b c-d
主要是不明白红色的这个-号从哪里来,谢谢大神们解释。我是初学者,见笑了。
public static void main(String[] args){
int x = 3;
if (x > 2) {
System.out.print("a");
}while (x > 0) {if (x == 2) {
System.out.print("b c");
}
x = x - 1;
System.out.print("-");if (x == 1) {
System.out.print("d");
x = x - 1;
}
}
}
}为什么输出是a-b c-d
主要是不明白红色的这个-号从哪里来,谢谢大神们解释。我是初学者,见笑了。
public static void main(String[] args){
int x = 3;//1
if (x > 2) {
System.out.print("a");//2
}
while (x > 0) {
if (x == 2) {
System.out.print("b c");//5
}
x = x - 1;//3
System.out.print("-");//4
if (x == 1) {
System.out.print("d");//6
x = x - 1;//7 然后跳出循环
}
}
}
}不明的话再聊