I use IntelliJ and I have a problem with a Scanner. Last element from the input is missing in the output. Any ideas?
Input: 1, 2, 3
Output: 1, 2
public static void main(String[] args) {
Scanner sc = new Scanner(System.in).useDelimiter(", ");
while (sc.hasNext()) {
System.out.print(sc.nextInt());
}
}