- What Is The Output Produced As A Result Of Executing The Following Program And Why Public Class Output Private Final 1 (29.98 KiB) Viewed 19 times
What is the output produced as a result of executing the following program and why? public class Output { private final
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
What is the output produced as a result of executing the following program and why? public class Output { private final
What is the output produced as a result of executing the following program and why? public class Output { private final static int SIZE 7: private Integer [] array: public Output (int num) { array new Integer [num]; } private int evaluate (int b) throws Exception { Integer result - 0: try { for (int i-0; i < b; i++) result array; } catch (ArithmeticException ex) { System.out.println("ArithmeticException clause"); } catch (Exception ex) { System.out.println("Exception: + ex); throw ex: } finally f System.out.println("Finally of evaluate"); } return result; } public static void main(String[] args) throws Exception { Output o: try { o new Output (SIZE); System.out.println("Value returned by evaluate + o. evaluate (8)); } catch (RuntimeException ex) { System.out.println("Caught: + ex); throw new Exception (ex); } finally { System.out.println("In finally"); } }