Java:自动重复打印语句

时间:2017-05-10 14:51:33

标签: java while-loop

我有这段代码:

import java.io.IOException;

public class Sample {

public static void main(String[] args) throws IOException {
    int b = 3;
    int c = 5;
    char mov;
    while(b != c) {
        System.out.println("Your next move?");
        mov = (char)System.in.read();
        System.out.println(mov);
    }
}
}

和输出:

Your next move?
b
b
Your next move?


Your next move?


Your next move?

为什么Your next move?连续打印3次而没有其他代码执行while循环?

0 个答案:

没有答案
相关问题