Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What class do you use to write to a file in Java?
Think of the class that begins with 'File'.
What do you call the value returned by the read() method when the end of file is reached?
This is a special integer value.
What is the primary purpose of FileWriter in Java?
Think about how we handle output in Java.
True or False: FileReader can only read binary files.
Consider the type of data FileReader handles.
Create a Java program that writes five lines of text to a file and then reads that file back to display the contents on the console.
Make sure to use \\n for new lines when writing.
Handle a scenario where a file might not exist and gracefully catch the exception using FileReader.
Think about using a try-catch block for handling exceptions.
4 more questions in this section. Enroll free to practise them all.
Enroll free