-7

This is the c++ code.

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

how to convert this code into java?.

Sumudu De Zoysa
  • 261
  • 1
  • 6
  • 17

2 Answers2

2
While(console.readLine() != - 1) 
{
Some logic
} 
Nirel
  • 1,855
  • 1
  • 15
  • 26
2

try

  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);
    }
Rustam
  • 6,485
  • 1
  • 25
  • 25