在IntelliJ IDEA 教育版进行单元测试时,控制台不支持 System.in 输入
我写的代码如下:
@Test
void main() {
Scanner scanner = new Scanner(System.in);
int judge = 1;
while (judge == 1)
{
int n = scanner.nextInt();
System.out.println("输入的数为:" + n);
if (n == 0)
judge = 0;
}
}