Hi everyone I am embarking on the path of the awesome language known as Java
and need some help or guidance rather
The code I am working with inputs a textfile and reverses characters in the file however I can't figure out how to instead of reversing characters reverse words
Any suggestions would be appreciated
Code: Select all
import java.io.*;
import java.lang.Object.*;
public class fileIT {
public static void main(String[] args) throws IOException {
BufferedReader inputFile = new BufferedReader(new FileReader("C:\\JavaCH\\helloworld.txt"));
String str;
while ((str = inputFile.readLine()) != null) {
StringBuffer theend = new StringBuffer(str);
StringBuffer reverse = theend.reverse();
System.out.println(reverse);
}
}
}