QUOTE(horace @ 22 Mar, 2007 - 05:40 AM)

QUOTE(javascreams @ 22 Mar, 2007 - 12:21 PM)

I am totally lost with this. Can you write the code out for me.
have a look at the example here
http://www.java2s.com/Code/JavaAPI/java.la...fferreverse.htmThis is as far as i got. It writes the file backwards. Can any1 finish my code by making the output of it to say
"7 words in a palindrome.txt"
"palindrome.txt contains a palindrome"
import java.util.*;
import java.io.*;
class Assignment2edit
{
public static void main(String args[])
{
try
{
FileReader reader = new FileReader("Palindrome.txt");
Scanner inputFile = new Scanner(reader);
String s = inputFile.nextLine();
StringBuilder sb = new StringBuilder (s);
StringBuilder sbRev = sb.reverse();
System.out.println(sbRev);
reader.close(); // Close textfile.txt
}
catch(Exception e)
{
e.getMessage();
}
}