Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

String fileName is read from input. Write a try block to: 2 Assign filelnStream with a new FilelnputStream that opens the file named fileName for

String fileName is read from input. Write a try block to:
2
Assign filelnStream with a new FilelnputStream that opens the file named fileName for reading.
Assign fScanner with a Scanner created using filelnStream.
Read the next floating-point number from the file into valueRead.
Ex: If the input is width2. txt, then the output is:
Value read from width2.txt: 3.4
Ex: If the input is badfil lon2. txt, then the output is:
Error opening file: badfile.txt
\table[[width1.txt,width2.txt]]
fileName = scnr.next ();
Y** Your code goes here */
catch (FileNotFoundException e){
errorFound = true;
}
if (fScanner != null){
fScanner. close();
}
if (errorfound){
System, out.println("Error opening file: "+ fileName);
}
image text in transcribed

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

Beginning PostgreSQL On The Cloud Simplifying Database As A Service On Cloud Platforms

Authors: Baji Shaik ,Avinash Vallarapu

1st Edition

1484234464, 978-1484234464

More Books

Students also viewed these Databases questions

Question

What leader behaviors would you recommend to Ted? Why?

Answered: 1 week ago

Question

1. Describe the types of power that effective leaders employ

Answered: 1 week ago