|
[SOLVED] file i/o problem
Hi.
I was writing a small code to facilitate text file reading and used the following code to read and display the text file.
while(handle.read()!= -1)
{
System.out.print((char)handle.read());
}
where handle is an object of FileInputStream class.
What it does is print the alternate charcters in the file starting from the second character.
Why is it behaving in such a manner? Please throw some light.
Alternatively, i used a code snippet from java 2 complete reference which is working just fine.
What i want to know is whats the problem with my logic or code and not interested in getting any new ways to do it cuz i already have a correct way to do it at hand.
Waiting..
aytidaalkuhs.
|