JAVA Exceptions Which of the following blocks execute compulsorily whether exception is caught or not. throws catch throw finally throws catch throw finally 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(); }} Compilation Error None of these One Two One Two Compilation Error None of these One Two One Two 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(); }} Compilation succeed but no output None of these Name-B Compilation fails-Exception NullPointerException is not compatible with throws clause in Value-A printName() Compilation succeed but no output None of these Name-B Compilation fails-Exception NullPointerException is not compatible with throws clause in Value-A printName() ANSWER DOWNLOAD EXAMIANS APP
JAVA Exceptions What happen in case of multiple catch blocks? None of these The superclass exception must be caught first. Either super or subclass can be caught first. The superclass exception cannot caught first. None of these The superclass exception must be caught first. Either super or subclass can be caught first. The superclass exception cannot caught first. ANSWER DOWNLOAD EXAMIANS APP
JAVA Exceptions Exception generated in try block is caught in ........... block. throw catch finally throws throw catch finally throws 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 ClassCastException IllegalStateException None of these NumberFormatException ArrayIndexOutOfBoundsException ClassCastException IllegalStateException None of these NumberFormatException ANSWER DOWNLOAD EXAMIANS APP