View Single Post
  #2 (permalink)  
Old 04-06-2008, 11:52 AM
CaptainMorgan's Avatar
CaptainMorgan CaptainMorgan is offline
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 839
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Welcome to the forums aytidaalkuhs!

Please remember to use [ code] [ /code] tags when posting code.

It's printing alternating characters from the second on because you made one call from within the while line, and another during the output line. See the API for more details. Take a view at the code too:
Code:
// read reads from the input stream while(handle.read()!= -1) { // with this, you've made one read here, comparing every other read to -1 // with this, you've made another read, outputting every other character System.out.print((char)handle.read()); }
My suggestion is you need a new way to do it, because if your intention is to print every char in the stream- well, this code just isn't working, now is it?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Reply With Quote