public static void main(String[] args) {
Scanner in = new Scanner(System.in);
in.useDelimiter(", "); // using delimiter ", "
int i = 1;
while(in.hasNextInt()){
i = in.nextInt();
System.out.println(i);
}
}
I am trying to get the input from console, but this code is not printing last integer How can I solve this problem. I don't want to use split and save the result in an array.