Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
What method do you use to check if a file exists?
Think about how you would confirm presence.
How would you create a new file named 'test.txt'?
Consider the sequence of creating a file.
What does the exists() method do?
Reflect on the importance of confirming a file's presence.
True or False: The length() method returns the last modified date of the file.
Consider what 'length' implies in context.
Design a Java program that checks if a specified file exists and deletes it. If it does not exist, print an appropriate message.
Remember to handle potential IOException for the delete operation.
Create a script that logs the sizes of multiple files in a directory and outputs them to a text file.
Utilize FileWriter for output and ensure you close it after writing.
5 more questions in this section. Enroll free to practise them all.
Enroll free