Hi everybody,
this was given to me as part of an example in one of my classes. I know what the code is supposed to do, but i dont really know how its done. So basically could someone comment the code and explain how it works.
It is supposed to sort out 5 "exam" objects given in by the user that are stored in "examArray" and then display the five objects by date. It appears to me that theres only one object being shown on screen in the JOptionPane, but ive been wrong in the past. If this is the case could someone please write a small piece of code doing so.
Thanks, see code below.
int lowest_loc = 0;
For (int m = 1; m <examArray.length; m++){
For (int i = 1; i <examArray.length; i++){
if(examArray[i] != null){
if(examArray[i].compareTo(examArray[lowest_loc])){
Lowest_loc = i;
}
}
}
JOptionPane.showMessageDialog(null, examArray[lowest_loc]);
examArray[lowest_loc] = null;