1. public class MyProgram { public static void throwit() { throw new RuntimeException(); } public static void main(String args[]) { try { System.out.println("Hello world "); throwit(); System.out.println("Done with try block "); } finally { System.out.println("Finally executing "); } } } which answer most closely indicates the behavior of the program?





Ask Your Doubts Here

Type in
(Press Ctrl+g to toggle between English and the chosen language)

Comments

  • By: guest on 02 Jun 2017 01.26 am
    Once the program throws a RuntimeException (in the throwit() method) that is not caught, the finally block will be executed and the program will be terminated. If a method does not handle an exception, the finally block is executed before the exception is propagated.
Show Similar Question And Answers
QA->Average height of 10 students in a class is 150 cm. A boy of height 160 cm left the class and a boy of height 148 cm is admitted. Then what is the average height of the students in the class now?....
QA->There are 50 students in a class. In a class test 22 students get 25 marks each, 18 students get 30 marks each. Each of the remaining gets 16 marks. The average mark of the whole class is :....
QA->If one wants to throw a cricket ball to the maximum distance; then at which angle should he throw it?....
QA->If one wants to throw a cricket ball to the maximum distance, then at which angle should he throw it ?....
QA->A process in which a public relations representative sends out press releases to various media outlets to promote a company change, a new product or a new service is known as....
MCQ->public class MyProgram { public static void throwit() { throw new RuntimeException(); } public static void main(String args[]) { try { System.out.println("Hello world "); throwit(); System.out.println("Done with try block "); } finally { System.out.println("Finally executing "); } } } which answer most closely indicates the behavior of the program?....
MCQ->What will be the output of the program? public class RTExcept { public static void throwit () { System.out.print("throwit "); throw new RuntimeException(); } public static void main(String [] args) { try { System.out.print("hello "); throwit(); } catch (Exception re ) { System.out.print("caught "); } finally { System.out.print("finally "); } System.out.println("after "); } }....
MCQ->What will be the output of the program? public class X { public static void main(String [] args) { try { badMethod(); System.out.print("A"); } catch (RuntimeException ex) / Line 10 / { System.out.print("B"); } catch (Exception ex1) { System.out.print("C"); } finally { System.out.print("D"); } System.out.print("E"); } public static void badMethod() { throw new RuntimeException(); } }....
MCQ->What will be the output of the program? public class MyProgram { public static void main(String args[]) { try { System.out.print("Hello world "); } finally { System.out.println("Finally executing "); } } }....
MCQ->What will be the output of the program? public class X { public static void main(String [] args) { try { badMethod(); / Line 7 / System.out.print("A"); } catch (Exception ex) / Line 10 / { System.out.print("B"); / Line 12 / } finally / Line 14 / { System.out.print("C"); / Line 16 / } System.out.print("D"); / Line 18 / } public static void badMethod() { throw new RuntimeException(); } }....
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use | Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions
Question ANSWER With Solution