如何将c ++代码转换为java

时间:2015-09-10 05:57:19

标签: java c++ converter

这是c ++代码。

while(scanf("%d%d", &m, &n) != -1) {
     //some logic
}

如何将此代码转换为java?

2 个答案:

答案 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
}