Consider the following code segment:
while( (ch = inputFile.read()) != VALUE) { outputFile.write( (char)ch ); }
Assume that inputFile is of type FileReader, and outputFile
is of type FileWriter, and ch is of type int.
The method read()
returns the character if successful, or VALUE if the end of the stream has been reached.
What is the correct value of this VALUE checked in the while loop for end-of-stream?.
a)
the read()
method returns the value -1 if end-of-stream (eoS) is reached, which is checked in this while loop.