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 does it mean to append to a file?
Think about what happens to the old data.
What class is used for writing data to a file?
Consider the name! What does it do?
What method is used to write a new line to a file in Java?
It starts with 'p' and is used commonly in output.
True or False: You can only write to a new file when using the FileWriter class.
Think about appending vs. creating a file.
Write a method that appends a list of strings to a file named 'messages.txt'. How would you handle exceptions?
Remember to always close your PrintWriter in a finally block or use try-with-resources.
Considering multiple users are adding to the same log file, what might be an issue, and how could it be resolved?
Think about how data integrity can be maintained.
4 more questions in this section. Enroll free to practise them all.
Enroll free