这是c ++代码。
while(scanf("%d%d", &m, &n) != -1) {
//some logic
}
如何将此代码转换为java?
答案 0 :(得分:3)
试
Scanner scanner=new Scanner(System.in);
int m,n;
while( (m =scanner.nextInt()) != -1 && (n=scanner.nextInt()) != -1) {
//some logic
System.out.println(m +"\t"+n);
}
答案 1 :(得分:2)
While(console.readLine() != - 1)
{
Some logic
}