public static void main(String[] arg) {
System.out.println("Enter the pairs: ");
Scanner kbd = new Scanner(System.in);
while(kbd.hasNextLine() ) {
int input1 = kbd.nextInt();
int input2 = kbd.nextInt();
maxcycle(input1,input2);
}
}
Hello,
The code given above is taking one line at a time and I am pasting this in input:
1 10
100 200
201 210
900 1000
It is supposed to read each line, take each integer and put it in input1 and input2 and call method maxcycle. However, the scanner isn't reading the last line.
*kbd.lastLine()
isn't working because I don't want a string. I want int.
please help, thanks.