Hi there in BB and KS book page 439
"2. 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,"
I tried to do this:
File f2 = new File("File3");
System.out.println("does the file2 exist?: " + f2.exists());
FileReader fr2 = new FileReader(f2);
When I run it:
does the file2 exist?: false
Exception in
thread "main" java.io.FileNotFoundException: File3 (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)
at chapter7.files.FileTest2.main(FileTest2.java:54)
Can someone pls explain me why the file didn't create when I created the FileReader instance?.. thanks.