JAVA Programming :: Basic Concepts - Discussion
Home > JAVA Programming > Basic Concepts > MCQs Questions Discussion
23 / 64
What all gets printed when the following gets compiled and run.
public class test {
public static void main(String args[])
{
inti=1, j=1;
try
{ i++;
j–;
if(i/j > 1)
i++;
}
catch(ArithmeticException e)
{
System.out.println(0);
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println(1);
}
catch(Exception e)
{
System.out.println(2);
}
finally
{
System.out.println(3);
}
System.out.println(4);
}
}
public class test {
public static void main(String args[])
{
inti=1, j=1;
try
{ i++;
j–;
if(i/j > 1)
i++;
}
catch(ArithmeticException e)
{
System.out.println(0);
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println(1);
}
catch(Exception e)
{
System.out.println(2);
}
finally
{
System.out.println(3);
}
System.out.println(4);
}
}
A0,3,4
B1,3,4
C0,2,4
D0,3,4
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
No Discussion on this question yet!