![]() |
My problem is that I want to be able to create an array, but instead of entering the array by hand, I want for it to be read in from a text file, a string token at a time. I then want to sort it, I have looked at using a selction sort etc, and read up on the java.util.Arrays.sort method, and just cant make it work.
My code is as follows: :
import java.util.*;I have a problem getting anything to be written to the fileout textfile, and my sort method again doesnt seem to work. Could anybody help me out please? Thanks Andy |
I made a few small changes to your program. I changed it first to a do-while loop, because it has to go through at least once. I also put your readline inside the loop. Then, your sort method was giving me some errors, so I used a sort method inside the collectinos class. Just changed three lines, basically. Here's your edited code.
:
import java.util.*; |
Hi, me and a couple of my freinds got together and have managed to come up with some different code. My question is whether there is any possible way at all to make this code more efficient, even if it is just making a snipet of the code shorter, or getting rid of a line here and there. You see we get marked on efficiency for this you see, and I also think my structure is not the best, if you have any suggestions how to make it better?
Thyanks :
Thanks mate Sco |
:)
|
| All times are GMT -5. The time now is 12:24 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC