File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Files 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 "Files" Watch "Files" New topic
Author

Files

Balaji Bang
Ranch Hand

Joined: Apr 23, 2007
Posts: 180

in K&B it is given :

Create a Reader or a Writer or a Stream. Specifically, create a FileReader, a
FileWriter, a PrintWriter, a FileInputStream, or a FileOutputStream.
Whenever you create an instance of one of these classes, you automatically
create a file, unless one already exists, for instance

But the following is giving FileNOtFoundException


This is working fine when I used PrintWriter and FileWriter . Not working only for FileReader . Why please explain...........
Stephen Davies
Ranch Hand

Joined: Jul 23, 2008
Posts: 352
File is not a file on your system. new File("MyFile.txt") is creating a new File Object from where you can call various Methods, to create a file on the system, such as .createNewFile(). If your using Sierra & Bates JAVA 5 see page 431, for more details. The example given there is:



Its a simple method for giving feedback on the existence of files, so;





be a well encapsulated person, don't expose your privates, unless you public void getWife()!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Files
 
Similar Threads
BufferedWriter, PrinterWriter etc
I found something wrong form K&B chapter 6
Creating an actual file
Will FileReader create a new file?
File IO