when i execute the above code, am getting the error as below.Pls let me know what's wrong with my code.import java.io.File; import java.io.FileNotFoundException; // import java.io.FileReader; //import java.io.IOException; import java.util.Scanner; public class test1 { /** * @param args * @throws FileNotFoundException */ public static void main(String[] args) throws FileNotFoundException { Scanner scan = new Scanner(new File("F:\\data\\file.txt")); while(scan.hasNext()){ String line = scan.nextLine(); System.out.println(line); } } }
at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:120) at java.util.Scanner.<init>(Scanner.java:636) at test1.main(test1.java:23)