Answer to Question #326774 in Java | JSP | JSF for timmy

Question #326774

What is the output of this program?

  1.     class Output {
  2.         public static void main(String args[])
  3.         {   
  4.              int x, y = 1;
  5.              x = 10;
  6.              if (x != 10 && x / 0 == 0)
  7.                  System.out.println(y);
  8.              else
  9.                  System.out.println(++y);
  10.       }
  11.     }

Select one:

a. 1

b. Runtime error owing to division by zero in if condition.

c. 2

d. Unpredictable behaviour of program.


1
Expert's answer
2022-04-10T17:45:13-0400

Answer is: c.2


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS