JAVA Exceptions What happen in case of multiple catch blocks? Either super or subclass can be caught first. None of these The superclass exception must be caught first. The superclass exception cannot caught first. Either super or subclass can be caught first. None of these The superclass exception must be caught first. The superclass exception cannot caught first. ANSWER DOWNLOAD EXAMIANS APP
JAVA Exceptions Determine output of the following program code?public class Test{ public static void main(String args[]){ int i; try{ i = calculate(); System.out.println(i); }catch(Exception e){ System.out.println("Error occured"); } } static int calculate(){ return (7/2); }} None of these 3 3.5 Compilation Error Error occured None of these 3 3.5 Compilation Error Error occured ANSWER DOWNLOAD EXAMIANS APP
JAVA Exceptions What will be the output?class MyClass{ public String test(){ try{ System.out.print("One"); return ""; } finally{ System.out.print("Two"); } }}public class Test{ public static void main(String args[]){ MyClass m = new MyClass(); m.test(); }} One Compilation Error None of these One Two Two One Compilation Error None of these One Two Two ANSWER DOWNLOAD EXAMIANS APP
JAVA Exceptions Which keyword is used to specify the exception thrown by method? throw finally throws catch throw finally throws catch ANSWER DOWNLOAD EXAMIANS APP
JAVA Exceptions What is the output for the below code ?import java.io.FileNotFoundException;class A{ public void printName() throws FileNotFoundException{ System.out.println("Value-A"); }}class B extends A{ public void printName() throws NullPointerException{ System.out.println("Name-B"); }}public class Test{ public static void main (String[] args) throws Exception{ A a = new B(); a.printName(); }} printName() Name-B Compilation fails-Exception NullPointerException is not compatible with throws clause in None of these Compilation succeed but no output Value-A printName() Name-B Compilation fails-Exception NullPointerException is not compatible with throws clause in None of these Compilation succeed but no output Value-A ANSWER DOWNLOAD EXAMIANS APP
JAVA Exceptions public class Test{ public static void main(String args[]){ try{ int a = Integer.parseInt("four"); } }}Which exception could be handled by the catch block for above? ArrayIndexOutOfBoundsException NumberFormatException IllegalStateException None of these ClassCastException ArrayIndexOutOfBoundsException NumberFormatException IllegalStateException None of these ClassCastException ANSWER DOWNLOAD EXAMIANS APP