Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

File  RSS feed

 
sean cee
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What can you do with a File object by invoking File methods?
1) create files
2) rename files
3) delete files
4) write to files
5) open files
My answer is 1,2,3 but answer is 2,3 ..
What do you guys think?
Thanks in advance....
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What test or Quiz was this from?
You are correct in your answer. A file Can be created in several ways using the File class (though they will empty)
createNewFile() and createTempFile()
 
sean cee
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just got it from someone's web site. There are only small number of questions and it is not a main stream one that most of people visit. ( Korean site that is ).
Thanks.
 
satishind Reddy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sean
createNewFile(), createTempFile() methods available in JDK1.3 version onwords.
Upto JDK1.2 version we cannot create file using 'File' class. It creates only File Object. we can send this object as a parameter in some I/O streams That streams create Actual File.
Most of mock exames give option one is false because of they all developed before jdk1.3 release.
Supose Sun askes this question in exame what answers we have to select... I think Java Guru's can give some tip on this issue.
Regards
Satish
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!