• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transient /File Class

 
Shailendra Bade
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Is it possible to create a physical file using
File Class. According to Barry Boone, it is possible
in Java 2 . Roberts/Heller do not mention any method for
this.
Also both books say that a transient variable cannot
be static and final but this compiles fine.
Shailendra Bade
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java 1.2 adds the static createTempFile methods (not instance methods, static), and the createNewFile method (an instance method).
The purpose of the transient modifier is to label variables that should not be serialized.
Bill
 
satish
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regarding transient variable, refer to RHE errata
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sure is possible to create a physical file using the File class.
File newFile = new File("newFile.txt");
will give you the handle newFile for a file that is very much physical.
carl
 
rajsim
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The statement
File newFile = new File("newFile.txt");
doesn't create a new physical file. It just creates a new
instance of File class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic