Question: Regarding to exception handling and multithreading programming, answer the following questions. (a) Explain the difference between a checked exception and an unchecked exception. (2

Regarding to exception handling and multithreading programming, answer the following questions. (a) 

Regarding to exception handling and multithreading programming, answer the following questions. (a) Explain the difference between a checked exception and an unchecked exception. (2 marks) (b) State the used of the keywords throw and throws. (2 marks) (c) Suppose that method causes an exception in the following try-catch block: public void method03 () throws Exception { try ( methodY (0.5); } } catch (Exception ex) ( ) System.out.println(ex); throw ex; finally ( } System.out.println("Finally block executed"); System.out.println("Program continue"); (i) Provide the code for methodY (double d), in which it should throw an Exception object with error message "Input argument must >=1" when the input argument d is smaller than 1.0. (4 marks) (ii) What is the output when methodQ3 is executed? (2 marks) (d) Explain how to create a thread pool with THREE (3) fixed threads in Java and how a task is submitted to a thread pool. (2 marks) (e) Explain race condition in a multithreaded program and how it can be avoided. (3 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!