7 Consider class hierarchy and code fragments: the following java.lang.Exception
ID: 3789447 • Letter: 7
Question
7 Consider class hierarchy and code fragments: the following java.lang.Exception java o. IOException java. io. StreamCorruptedException java.net. MalformedURLException 1. try 2. URL u new URL (s); assume s is previously defined 3. Object o in. readobject(); in is an 0bjectInputStream 4. System. out.println("Success"); 5. 6. catch (Mal formed URLException e) 7. System.out.printlnC" Bad URL"); 8. 9. catch (StreamCorruptedException e) 10 System.out.print Inc Bad file contents 12. catch (Exception e) 13 System. out.printinC "General exception") 14. 15. finally 16 System out.printlnC doing finally part 18. System out.printlnC" Carrying on");Explanation / Answer
7. Output will be following since no error or exception was thrown:-
A. Success
E. doing finally part
F. Carrying on
8. The output is following since error was thrown and only finally will execute:-
E. doing finally part
9. The most apportioned is:
B. if(!f.exists()){
throw new IOException("file "+f.getName()+" not found");
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.