I'm trying to figure out small parts of the code I'll need for this task. I'm currently working with making sure the number is even. But there's something wrong and I don't know what it is, when I run the code with the example inputs it prints 9 & 4, one is even and one isn't, but it should only print one or the other if everything is correct and I just have it backwards, so what's wrong?
package en.codegym.task.pro.task04.task0408;
import java.util.Scanner;
/*
Maximum of entered numbers
*/
public class Solution {
public static void main(String[] args) {
//write your code here
Scanner console = new Scanner(System.in);
int max = -2000000000;
while (console.hasNextInt()) {
if (console.nextInt() % 2 == 0) {
System.out.println(console.nextInt());
}
}
//System.out.println(max);
}
}