This program reads integers that are input from the user, sorts them, and prints out the result as a Stack.
This program demonstrates code reuse by:
- Using Java Collections Framework ('List', 'Stack', and 'Collections.sort')
- Factors input and sorting logic into a helper class ('NumberLists')
cd src
javac Main.java NumberLists.java
java Maincd src
javadoc -d doc Main.java NumberLists.java
open doc/index.htmlInput:
5
5 2 9 1 5
Output:
Sorted Stack: [1, 2, 5, 5, 9]
See attached PDF.