R

Ram Avtar Sharma • 4.50K Points
Extraordinary

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: 24
  • Filed under category JAVA

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.


Question analytics