Answers for "read file from command line in java"

0

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;
Posted by: Guest on June-14-2021
0

java read file from command line argument

import java.util.Scanner;
import java.io.File;
Scanner input = new Scanner(new File(args[0])); //Where args[0] is the cmd argument, the file name
Posted by: Guest on April-02-2020

Code answers related to "read file from command line in java"

Python Answers by Framework

Browse Popular Code Answers by Language