The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

io problem

Posted by tt on April 20, 2001 at 12:53 AM

hi
suppose we read from a file by using any stream say fileinputstream as
fileinputstream fis =new fileinputstream("one.java");
int c;
while((c=fis.read())!=-1)
System.out.print(c);
my question is
1. why can't we declare the variable c within the while loop as
while((int c=fis.read())!=-1)
2.when we output the result using system.out.println we get bytes as output,however when send the output to a file using fileoutputstream the file appears the same as input .why is the difference in this output by both streams.
thankx in advance
tt



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us