Question: Which digits, and in which order, will be printed when the following program is run? Select the one correct answer. (a) The program will only
Which digits, and in which order, will be printed when the following program is run?
![public class DemoClass { public static void main(String[]args) { int k=0; }](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1706/9/4/1/17465bddaf6eded81706941170165.jpg)
Select the one correct answer.
(a) The program will only print 5.
(b) The program will only print 1 and 4, in that order.
(c) The program will only print 1, 2, and 4, in that order.
(d) The program will only print 1, 4, and 5, in that order.
(e) The program will only print 1, 2, 4, and 5, in that order.
(f) The program will only print 3 and 5, in that order.
public class DemoClass { public static void main(String[]args) { int k=0; } } try { int i = 5/k; } catch (ArithmeticException e) { System.out.println("1"); { } catch (RuntimeException e) System.out.println("2"); return; } catch (Exception e) { System.out.println("3"); } finally ( System.out.println("4"); } System.out.println ("5");
Step by Step Solution
3.38 Rating (151 Votes )
There are 3 Steps involved in it
d The program will print 1 4 and 5 in that order The expression 5k will throw an ArithmeticExc... View full answer
Get step-by-step solutions from verified subject matter experts
