1.

Which of these values is returned by read() method is end of file (EOF) is encountered?(a) 0(b) 1(c) -1(d) NullThis question was addressed to me by my college director while I was bunking the class.Question is taken from Reading & Writing Files in portion I/O & Applets of Java

Answer»

Right option is (C) -1

The best explanation: Each time read() is called, it reads a single byte from the FILE and returns the byte as an INTEGER value. read() returns -1 when the END of the file is encountered.



Discussion

No Comment Found

Related InterviewSolutions