Can anyone point out why this is not validating? Much appreciated!
package en.codegym.task.pro.task04.task0410;
import java.util.Scanner;
/*
Second smallest number entered
*/
public class Solution {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int min = console.nextInt();
int secondMin = console.nextInt();
if (min > secondMin) {
int tmp = min;
min = secondMin;
secondMin = tmp;
}
while (console.hasNextInt()) {
int x = console.nextInt();
if (x < min) {
min = x;
} else if (x > min && x < secondMin) {
secondMin = x;
}
}
System.out.println(secondMin);
}
}