Correct Answer : Get Lastest Questions and Answer : Explanation: In given statement we can see that, we have passed negative value for creating int array, which results a NegativeArraySize Except ion. Hence option B is correct. Option A is incorrect as it is thrown when an application attempts to use null in a case where an object is required. Option D is incorrect as IndexOutOfBoundsException thrown to indicate that an index of some sort (such as to an array, to a string, or to a vector) is out of range.
Question : You have been given following code snippet
float x = 22.00f % 3.00f; int y = 22 % 3; System.out.print(x + ", " + y);
1. Adding the public modifier to the declaration of method1 at line n1 2. Removing the public modifier from the definition of method1 at line n2 3. Access Mostly Uused Products by 50000+ Subscribers 4. Changing the line n4 DoClass doi = new DoClass ( );
What is the result? 1. Execution terminates in the first catch statement, and caught a RuntimeException is printed to the console 2. Execution terminates In the second catch statement, and caught an Exception is printed to the console. 3. Access Mostly Uused Products by 50000+ Subscribers 4. Execution completes normally, and "Ready to use" is printed to the console. 5. The code fails to compile because a throws keyword is required.