A

Admin • 828.03K Points
Coach

Q. What will be the output of the following Java code?

Code:
class Output
{
public static void main(String args[])
{
int x , y = 1;
x = 10;
if (x != 10 && x / 0 == 0)
System.out.println(y);
else
System.out.println(++y);
}
}
  • (A) 1
  • (B) while
  • (C) Runtime error owing to division by zero in if condition
  • (D) Unpredictable behavior of program
  • Correct Answer - Option(B)
  • Views: 10
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.