What will be the output of the following Java program?class exception_handling {public static void main(String args[]) {try {int a = 1;int b = 10 / a;try { if (a == 1) a = a / a - a; if (a == 2) { int c[] = {1}; c[8] = 9; }finally {System.out.print("A");} }catch (NullPointerException e) {System.out.println("B");}}}

🎲 Try a Random Question  |  Total Questions in Quiz: 177  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
Java Basics Practice Test: java.lang & java.io — practice the complete quiz, review flashcards, or try a random question.

java quiz on various concepts of java.lang, including data types, types of classes, character and byte streams, builtin exceptions, rounding functions, system class, byte, short, double and float wrappers, character and boolean wrappers and environment properties. Java.lang and java.io are two of the most important packages in the Java programming language. Here's a summary of what each of them contains and the differences between them. java.lang Contains classes and interfaces that are fundamental to the design of the Java programming language. Includes classes such as Object, String,... Show more

What will be the output of the following Java program?<br>class exception_handling <br>{<br>public static void main(String args[]) <br>{<br>try <br> {<br>int a = 1;<br>int b = 10 / a;<br>try <br>{<br> if (a == 1)<br> a = a / a - a;<br> if (a == 2) <br> {<br> int c[] = {1};<br> c[8] = 9;<br> }<br>finally <br>{<br>System.out.print("A");<br>}<br> <br>}<br>catch (NullPointerException e) <br>{<br>System.out.println("B");<br>}<br>}<br>}