Question: 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);
}
 String fileName is read from input. Write a try block to:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!