Read the method you are calling on System.out and see what it does. I shall remind you of the location of its API documentation: here. Look through that API page and you will find other methods; I think one with a rather similar name will help your problem.
Interestingly, John's first code listing, and John's most recent code listing are not the same.
In the first listing, the sysout is in the catch block, and hence, won't print anything unless an exception is thrown. In the most recent listing, it should work.
Henry Wong wrote:
Interestingly, John's first code listing, and John's most recent code listing are not the same.
In the first listing, the sysout is in the catch block, and hence, won't print anything unless an exception is thrown. In the most recent listing, it should work.
Henry
Yep I agree. That's all I did. Move the System.out.print(c); outside the catch. As Henry says this code should work fine.
What happens in your case? No output at all? You do need to wait for a couple of seconds before the output starts showing of course!
P:S -> The code you posted works fine. I did try it out once more with no changes at all
Nopes I get a straight line,
***Welcome to the MTH junior CAT***Press any key to continue . . .
Not sure why you are getting it on a different line .. Beats me!!
John Eipe
Ranch Hand
Joined: May 23, 2008
Posts: 205
posted
0
When I ran this from Command Line it worked!
But when I try this in NetBeans I get the previous output. I tried resizing the Output window et all but to no use.
John Eipe
Ranch Hand
Joined: May 23, 2008
Posts: 205
posted
0
I ran this in Netbeans with 100 millisec sleep time and it works. But if I increase it, gives the old one.