Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following program uses command line arguments to create a Scanner object to read from a file. Fill in the blanks to complete this Java
The following program uses command line arguments to create a Scanner object to read from a file. Fill in the blanks to complete this Java class, public class Demo{public static void main(String|| args) throws FileNotFoundException{//check and read command line argument for file name String fileName; if (args. _________ > 0) {fileName = ________;} else {fileName = _________;} _______ fileReader = openFile(fileName);} private static String promptForFileName() {System.out.println('Enter the file name: "); Scanner keyln = new Scanner(Systen.in); return keyln.next();} private static Scanner openFile(________ fileMame) throws FileNotFoundException {File file - new File(________); while (!file.exists()) {file = new File(________);} return new Scanner(____);}}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started