Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, please look at the code
Which of the following are true statements?
1) I/O in Java can only be performed using the Listener classes
2) The RandomAccessFile class allows you to move directly to any point a file.
3) The creation of a named instance of the File class creates a matching file in the underlying operating system only when the close method is called.
4) The characteristics of an instance of the File class such as the directory separator, depend on the current underlying operating system
Answers:
2,4
The below is explanantion for answer not being 3
The File class can be considered to represent information about a file rather than a real file object. You can create a file in the underlying operating system by passing an instance of a file to a stream such as FileOutputStream.
//The file will be created when you call the close method of the stream.
I cant understand the statement //...
Even if the close() method is not invoked also, the file
is created with data.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic