In my class, we need to create a program where you can add students marks and then sort them by size.
"Sort the marks array in ascending order and display the sorted array in a JTextArea
."
//(This is from a private void for the "sort" button)
// declaring variables
int intValuesMarks;
// assigning values to variables
intValuesMarks = Integer.parseInt(AllMarks.getText());
ArrayList<Integer>arrValueList = new ArrayList<Integer>();
arrValueList.add(intValuesMarks);
Collections.sort(arrValueList);
AllMarks.setText("" + arrValueList);
When I try to run it I get this error:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "
14
14
21
42
12"
(The numbers above being the numbers I inputted before to try the program)
Help!
Thank you.