Could any one help me to create a program that can do the following thing: for example : I have a file name.txt contain bell things bob Code (markup): after the program run , I get bell bob things Code (markup): this program just arrange the words according to the alphabet. Could any one help me to do this? Thank you
sort routine at sun.com or java.com or a search with 'sort on java' on googxx need 4 parts, but depend on it is a java application(.exe/.sh) or java applets(.class) 1. file manage i/o=> create, open or read/write 2. an array for holding 3 strings and 3. check for first char in each elements in the array of string 4. most important: it seem a assignment/homework, suggest try harder
Like mattcch2007 said, this sounds like a homework assignment so i'm not gong to give you any code, but this is the general structure you want: Open the input file Read in each line into an array Sort the array Open the output file Write each element from the array into the output file The libaray java.io provides facilities for opening/reading/writing files. I'm not sure where you would find a sorting function, but maybe java.lang or java.util. Good luck with it.
I'm not going to tell you, but hopefully this TUTORIAL that one of our user created would help You'll just need to implement your logic. HINT: use StringTokenizer