how to read file from console in java

123

how to read file from console in java -

Scanner in = new Scanner(System.in); 
System.out.println("Enter file path");
String s = in.nextLine(); //C:\\testing.txt
br = new BufferedReader(new FileReader(s)); // And to use that file path in the FIleReader use like this;

Comments

Submit
0 Comments