• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jqplus - File class  RSS feed

Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question ID :958267742300
Which of the following statements regarding java.io.File are true?
1.You can delete a File or Dir represented by the File Object by just using that object.
2.You cannot create a File Object if a file/dir of that name do not exist.
3.You can create files in any directory using its API
4.Once created there is no way of changing the file/dir the File obj represents.
5.You can traverse between directories.
Correct options 1,3 and 4. I got it right, but feel the options can be rephrased a bit.
For options 1 and 3, both the methods providing the described functionality throw SecurityException if the SecurityManager does not allow the appropriate access to delete/create a file. Perhaps these options can be modified to say something like File class provides for methods to delete or create files or that one can delete/create a file by using a File object provided relevant permissions exist.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!