Menu

[Solved]-Question 1 Given Following Hierarchy Exceptions 1 Exception Subexception Extends Exception Q37295207

QUESTION 1 Given the following hierarchy of exceptions 1. Exception SubException extends Exception SubSubException extends Su

QUESTION 1 Given the following hierarchy of exceptions 1. Exception SubException extends Exception SubSubException extends SubException And the following section of code Scanner in – new Scanner (System.in) int num = in.nextInt(); try if (num<0) throw new Exception () throw new SubException) throw new SubSubException ) } else if ( num = 0) else catch (Exception e) System.out printin(“Message 1″): System.out.println Message 2”) System.out printin(“Message 3”) catch (Subexception e) t t catch (SubSubException e) System.out printn(“Message 4”); Assuming the user enters the number 5 as input, what will be printed? C A Message 2 BMessage 3 Nothing will get printed – the program will not compile Message 3 Message 4 E. Message 1 Message 2 Message 4 QUESTION 2 Why did you choose the answer you did in Question 1? Explain your thinking as clearly as possible. (Remember, you are being graded on your explanation, and I will use your explanations to help determine where we need to work more on concepts.) 1. Show transcribed image text QUESTION 1 Given the following hierarchy of exceptions 1. Exception SubException extends Exception SubSubException extends SubException And the following section of code Scanner in – new Scanner (System.in) int num = in.nextInt(); try if (num

Expert Answer


Answer to QUESTION 1 Given the following hierarchy of exceptions 1. Exception SubException extends Exception SubSubException exten… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *