I am a beginner in java. I wrote the following code in netbeans.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sanfile;
import java.io.*;
/**
*
* @author santak
*/
public class SanFile {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
File f = new File("doc.dat");
boolean b;
b = f.exists();
if(b == true)
System.out.println("File exists.");
else
System.out.println("File doesn't exist.");
// TODO code application logic here
}
}
the file doc.dat and SanFile.java are in the same directory but still the output is File doesn't exist.
what may be the reasons?