Storing userinputed ints
Hey ,i'm new to the java world so i don't know if it is a silly question or not,so please forgive me if it is. ^^ I was just wording if i could make a program that let the user enter an unknown number of ints,and that it will store all of them,kind of like to fill an array. maybe with the help of "..." as in "(int...numbers)". i want to use this loop : and that it will store all the numbers that the user is giving,becuase later i want to so stuff with them ( like sum or put them in an array ) import.java.util.Scanner; public class e5x1 { public static void main(String[] args) { Scanner userInput = new Scanner(System.in); System.out.println("Please enter a number , 0 to exit"); int usernumber = userInput.nextInt(); while (usernumber > 0) { if (usernumber > 0) { System.out.println("thank you"); usernumber = userInput.nextInt(); } } } }