Question

CIS 265 Summer 2018-Qui Name:rsh inor e csuID: 142358 Given the lav a program below, please write xception extends Eogion pablic class onert public Othert System.autpintn Showe pablik class Qaks public static wod mainShr ingl r try calerO 1catch lOtherException ex) System.out.prntinBeach Tie public statik void callerl) throws OtherException System.out printin Surny String str Beach Time throw new Other ExceptionlThundersiorm System.out.printinlloodingl Output line1: Output line2: Output line3:
0 0
Add a comment Improve this question Transcribed image text
Answer #1

--> output line1 Sunny

--> output line2 Shower

--> output line3 Beach Time

Reason:--> The main() function call the static method caller() inside try block.

In the first line, it prints the "Sunny" and goes to next line. In next line if condition becomes true so it throws the OtherException and calls the constructor of OtherException class and print the message "Shower" in next line (Which is output 2) and since the try block throwing the OtherException So it goes to catch block and print the "Beach Time " in line 3.

In case, If condition of Caller() function becomes false, It will not throw an exception and catch block will not be executed.

thanks................

If you need any help regarding this solution, Please leave a comment.....................

Add a comment
Know the answer?
Add Answer to:
CIS 265 Summer 2018-Qui Name:rsh inor e csuID: 142358 Given the lav a program below, please...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT