File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Transient /File Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Transient /File Class" Watch "Transient /File Class" New topic

Transient /File Class

Shailendra Bade

Joined: Jul 04, 2000
Posts: 22

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
Also both books say that a transient variable cannot
be static and final but this compiles fine.
Shailendra Bade

Shailendra Bade<BR>Mumbai, India<BR>Mail to:
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
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.

Joined: Jul 03, 2000
Posts: 27
Regarding transient variable, refer to RHE errata

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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.
Ranch Hand

Joined: May 31, 2000
Posts: 116
The statement
File newFile = new File("newFile.txt");
doesn't create a new physical file. It just creates a new
instance of File class.
I agree. Here's the link:
subject: Transient /File Class
It's not a secret anymore!