April 27, 2010 at 3:10 PM
Your code works fine here.
April 27, 2010 at 4:19 PM
The error is hard to pust. but if you execute the code,
1. enter a string the first input request (eg hello world),
3. ENTER n
The code will not terminated after the 'n'. This is because the first char is missing and from the readLine(). You would have to to enter 'nn'
for the code to exit. I think the problem is caused by the read() statement, just don't know why.
If on step 3 you type bye world, you would see the text (ye world), again the first char is missing.
Could you please check again. I have to use the System.in.read() for this home work.