I am writing a simple program to calculate the average of a set of numbers. You get the numbers using Scanner, so I am using while loop with .has
Scanner
while
.has
You could simply use the keyword break to stop the while loop:
break
while(Input.hasNextInt()){ count++; temp = Input.nextInt(); sum += temp; System.out.println(temp); System.out.println(count); break; } // End of while