Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

3-38. You want to be hired for a job.

Answered: 1 week ago