-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
  • 247
  • 3
  • 15

2 Answers2

2
While(console.readLine() != - 1) 
{
Some logic
} 
Nirel
  • 1,734
  • 1
  • 12
  • 24
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,307
  • 1
  • 21
  • 25