Answered step by step
Verified Expert Solution
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:
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 floatingpoint number from the file into valueRead.
Ex: If the input is width txt then the output is:
Value read from widthtxt:
Ex: If the input is badfil txt then the output is:
Error opening file: badfile.txt
tablewidthtxtwidthtxt
fileName scnrnext ;
Your code goes here
catch FileNotFoundException e
errorFound true;
if fScanner null
fScanner. close;
if errorfound
System, out.printlnError opening file: fileName;
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