Please i need some help with my programing assigment in Java

Please i need some help with my programing assigment in Java

Consider the following class hierarchy and cod fragments: java.lang.Throwable/\\ java.1ang.Error j ava.lang.Excepti on/\\ java.lang.OutOfMemoryError java.io.IOException/\\ j ava.10.StreamCorruptedExcepti on j ava.net.MaiformedURLExcepti on try {URL u = new URL(s);//assume s is previously defined Object o = in. readObject();//in is an ObjectlnputStream System.out.println(\"Success\");} catch (MaiformedURLException e) {System.out.printlnC\'Bad URL\");} catch (StreamCorruptedException e) {System.out.printlnC\'Bad file contents\");} catch (Exception e) {System.out.printlnCGeneral exception\");} finally {System.out.printlnC\'doing finally part\'):} System.out.println(\'Carrying on\"); What lines are output if the method at line 3 throws an OutOfMemoryError? Success Bad URL Bad file contents General exception doing finally part Carrying on

Solution

e. doing finally part.

since it is throwing an error exception, there are no catch blocks that are fitting to catch it. hence the code in the finally block runs, printing “ doing finally part” and then the method exits.

Please i need some help with my programing assigment in Java Consider the following class hierarchy and cod fragments: java.lang.Throwable/\\ java.1ang.Error j

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site