JAVA String !!Help!!

I have coded JAVA requirement below, but nothings displays in the console when I run the program.

Could someone assist me in solving this problem?

Requirements:

In this project, you will work with Java String. You are to write a program that does the following tasks:

1) Ask the user for the name of the input file and the name of the output file
2) Read a string from the input file (assume that the string is there)
3) Determine its reverse string and write both the original string and its reverse to the output file
4) Determine the number of non-duplicate characters from the original string, then write this number and those characters into the output file

Note that white spaces such as blanks do not count as a character, and lower-case character is the same as its upper-case character.

For example:

Input String Reverse String Number of non-duplicate characters

ABCD DCBA 4 (A, B, C, D)

Abcd dcbA 4 (A, B, C, D)

Aa Bb bB aA 2 (A, B)

Please use the following data to test your program:

Aa Bb

Code:
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Files
{

public static void main(String args[])
{
try
{
// open a input file to read the contents
BufferedReader in = new BufferedReader (new FileReader("in.txt"));

// open a output file to read the contents
BufferedWriter out = new BufferedWriter (new FileWriter("Tes1.txt", false));

// declare an array to keep track of non-duplicate characters
boolean alpha[] = new boolean[26];
String str = "";
do
{

// read a line from input file
str = in.readLine();

// break upon no data
if (str == null)
break;
else
{

// initialize the non-duplicate array
for (int i = 0; i < 26; i++ )
alpha[ i ] = false;

int count = 0; // initialize the count to zero

// find the length of the string
int l = str.length();

// write the string to the output file
out.write (str + "\t\t");

// declare a character array and allocate memory to it
char rev[] = new char[ 1+1 ];

// get the reverse of the string
for (int i = 0; i < 1; i++)
{

// get characters of the string from the right to left
rev[ i ] = str.charAt( 1-i-1 );

// write the characters to the output file
out.write(rev[ i ]);

// ignore the white space characters
if (Character.toUpperCase ( rev[ i ]) < 65)

// check for the duplication and if not increase count
if (alpha[Character.toUpperCase (rev[ i ]) - 65 ] == false )
{
alpha [Character.toUpperCase (rev[ i ]) - 65 ] = true;
count++;
} // end if
} // end for

// write the count to the output file
out.write ("\t\t" + count + " ( " );

// write all the non-duplicate characters to the output file
for (int i = 0; i < 26;i++)
if (alpha[ i ] == true)
out.write( (char) (i+ 65) + ", ");
out.write (")\n");
} // end else-if

} while (true); // continue to read one more string from input file

// close the input and output file
in.close();
out.close();
} // end try

catch (IOException e)
{
}
} // end method main
} // end class Files
[3769 byte] By [kottyn] at [2007-11-20 11:21:23]
# 1 Re: JAVA String !!Help!!
- Use code tags

- Use a LOT less exclamation points
Martin O at 2007-11-10 2:14:05 >
# 2 Re: JAVA String !!Help!!
Please use code tags when posting code.

What did you expect to be written to the console?

You haven't any code that actually outputs to the console all your output code writes to the file "Tes1.txt". If you want something to appear on the console you need to use a line like the following:
System.out.println("Hello World");
keang at 2007-11-10 2:15:06 >
# 3 Re: JAVA String !!Help!!
Keang,

Thanks - For the response. I'm trying to locate my output code that writes to text file called "Tes1.txt"

I look in my working directory, and I only see the Files txt file. I'm I missing something?

Thanks
kottyn at 2007-11-10 2:16:07 >
# 4 Re: JAVA String !!Help!!
Your question was:
I have coded JAVA requirement below, but nothings displays in the console when I run the program.

Could someone assist me in solving this problemWhat has this got to do with
I'm trying to locate my output code that writes to text file called "Tes1.txt" If you don't clearly state your problem you won't get any sensible answers and if you repeat this folly then people eventually won't bother answering your posts at all. So before I waste my time providing another answer please clearly state exactly what you expect the program to be doing (and why you expect it to be working that way) and exactly what it is doing.
keang at 2007-11-10 2:17:12 >
# 5 Re: JAVA String !!Help!!
I'm I missing something?Yes, you asked about the console output, and when someone was kind enough to try to help you with that, you ignored him and asked a different question. I think you're missing an apology.

Assuming you have provided an input text file in the correct place, the output text file will be in the same place. If you print out the exception message in your 'catch...' block, instead of ignoring it, you might find out why it isn't working.

Why do we never have time to do it right, but always have time to do it over?
Anon.
dlorde at 2007-11-10 2:18:13 >