wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes File I/O prior to Java 1.5 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 "File I/O prior to Java 1.5" Watch "File I/O prior to Java 1.5" New topic
Author

File I/O prior to Java 1.5

Sandra Bachan
Ranch Hand

Joined: Feb 18, 2010
Posts: 434
From Chapter 6 of Sierra/Bates, I understand that prior to Java 5 PrintWriter didn't have constructors that took either a String or a File.

However, when I compile the code with:

% javac -source 1.4 Writer.java

It works. Please see code below and advise. From what I understand, it should NOT work:




Marriage Made in Heaven
http://www.youtube.com/user/RohitWaliaWedsSonia
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
You are confusing the Java compiler with the Java API. The -source 1.4 switch tells the compiler to compile the code as if the compiler version was 1.4 (no generics, etc). The Java API is still the whatever is in the jar file.
Sandra Bachan
Ranch Hand

Joined: Feb 18, 2010
Posts: 434
Thanks for the clarification!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File I/O prior to Java 1.5
 
Similar Threads
Dynamically Creating Files......
working with files and directories
I/O - creating a directory vs. not creating a dir
Creation of a new file throws IOException
What''s going on with file names??