Question
class exception_handling
{
public static void main(String args[])
{
try
{
int a[] = {1, 2,3 , 4, 5};
for (int i = 0; i < 5; ++i)
System.out.print(a[i]);
int x = 1/0;
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.print("A");
}
catch(ArithmeticException e)
{
System.out.print("B");
}
}
}
a.
12345
b.
12345A
c.
12345B
d.
Compilation Error
Posted under Java Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. Which of these class provides various types of rounding functions?
View solution
Q. Which of these methods return a smallest whole number greater than or equal to variable X?
View solution
Q. Which of these method returns a largest whole number less than or equal to variable X?
View solution
Q. Which of function return absolute value of a variable?
View solution
Q. Which of these methods of Byte wrapper can be used to obtain Byte object from a string?
View solution
Q. Which of the following methods Byte wrapper return the value as a double?
View solution
Q. Which of these is a super class of wrappers Byte and short wrappers?
View solution
Q. Which of these methods is not defined in both Byte and Short wrappers?
View solution
Q. Which of these methods of Character wrapper can be used to obtain the char value contained in Character object.
View solution
Q. Which of the following constant are defined in Character wrapper?
View solution
Q. Which of these is a super class of Character wrapper?
View solution
Q. Which of these methods is used to know whether a given Character object is part of Java’s Identifiers?
View solution
Q. Which of these coding techniques is used by method isDefined()?
View solution
Q. Which of these methods of Boolean wrapper returns boolean equivalent of an object.
View solution
Q. Which of the following constant are defined in Boolean wrapper?
View solution
Q. Which of these methods return string equivalent of Boolean object?
View solution
Q. Which of these methods is used to know whether a string contains “true”?
View solution
Q. Which of these class have only one field?
View solution
Q. Which of these class contains all the methods present in Math class?
View solution
Q. Which of these method return a pseudorandom number?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!