InputStream in = new FileInputStream(...); try { System.out.print("A"); // code that could cause an exception System.out.print("B"); } catch (IOException e) { System.out.print("C"); } finally { in.close(); System.out.print("D"); } System.out.println("E"); What will be the string print in output if the try blocks throws a FileNotFoundException exception? ACDE ABDE ABCDE ACD
Added by Sarah C.
Close
Step 1
The code starts by creating an InputStream object called "in" using the FileInputStream class. Show more…
Show all steps
Your feedback will help us improve your experience
Syed Vasi and 51 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
To avoid an IOException exception with files,you can either use a try...catch block or make sure there is a file before attempting to read characters from it.This can be done by: a. calling the File.Exists( ) method b. using a loop to cycle through the file structure c. throwing an exception d. including statements in a finally block e. placing a test loop in the Main( ) method
All of the following are exceptions classes that are thrown in conjunction with files, except: a. DirectoryNotFoundException b. EndOfStreamException c. InvalidDataFileException d. FileNotFoundException e. IOException
When you are finished processing a text file, you should: a. call the Finished( ) method b. call the Close( ) method c. throw an exception d. erase the file e. reset the file
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD