I'm sorry to post the whole class, but I don't know how to reduce this correctly. The problem is the printSortedScreen method, which is supposed to print the unsorted column first, then the sorted column, but it actually prints both columns sorted. I don't know what I've done wrong..
The first parameter is an object reference. When you sort the array named toSort inside the method, it sorts the array referred to by the parameter you send.
What you need to do is something like create a temporary array inside the method and copy the contents of the array to be sorted into it. Then sort that array instead of the array referred to by toSort.
Making the array reference final does not prevent the elements in the array from being changed. It prevents the array name from pointing to another array.
For example, this works with no problem
, but this causes a compile-time error.
[ February 17, 2006: Message edited by: Keith Lynn ]
Joined: Feb 03, 2005
My heart is broken that final doesn't work the way I thought. But of course it doesn't, no matter how much I say "but I *did* push the jump button"
[ February 17, 2006: Message edited by: Jesse Crockett ]
subject: static final int wont print unsorted column