java - 'Reading an unknown amount of values'? Unsure what to do -
I need to create a program in Java that reads an unknown amount (integer), and when entered a negative value
"Itemprop =" text ">
Here is the code:
scanner = new scanner (System.in); Int num = in.nextInt (); & lt ; Integer & gt; Lst = new ArrayList & lt; Integer & gt; (); while (num> = 0) {lst.add (num); Num = in.nextInt ();} Collections.sort (lst ); System.out.println ("Trimmed Input:" + lst);
This takes input from the console.
It takes input to a neg, not registered (as you have mentioned in your question)
The result does not occur after the nagg. (As you have your question Is mentioned in the comment)
Comments
Post a Comment