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 what checks for a file's presence.
How do you create a new File object for 'myfile.txt'?
Remember how we declare an object in Java.
What does the method exists() in the File class do?
Focus on the purpose of the method.
True or False: The File class can only represent files, not directories.
Consider what else you can represent with the File class.
Write a Java program that prompts the user for a file name, checks if it exists, and either displays the full path or an error message.
Use methods from the File class to accomplish this task.
Explain how the File class can be used to check file permissions apart from checking existence.
Think about the various interactions you might need with files.
5 more questions in this section. Enroll free to practise them all.
Enroll free