Files and I/O
- Which jar provides FileUtils which contains methods for file operations?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
FileUtils is a part of apache commons which provides various methods for file operations like writeStringToFile.
- Which feature of java 7 allows to not explicitly close IO resource?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Any class that has implemented Autocloseable releases the I/O resources.
- Which of these methods is used to write() into a file?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
write()
- Which of these exception is thrown by close() and read() methods?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Both close() and read() method throw IOException.
- Which of these values is returned by read() method is end of file (EOF) is encountered?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
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.