5 years ago in Java Classes And Methods

What is the output of this program?
class Output {

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] 2
[C] Runtime Error
[D] Compilation Error
Loading...
Next Question

Overall Stats

Attempted 193
Correct 19
Incorrect 104
Viewed 70

Answers

Guest
Guest
Shamsa hafeez
Shamsa hafeez - 6 days ago

Shamsa hafeez from Lahore, Pakistan is saying 2 is correct answer

Zo Go
Zo Go - 1 month ago

Zo Go from Casablanca, Morocco is saying 2 is correct answer

Assaad Amine
Assaad Amine - 1 month ago

Assaad Amine from Casablanca, Morocco is saying 2 is correct answer

Awa Kone
Awa Kone - 1 month ago

Awa Kone from Berrechid, Morocco is saying 1 is correct answer

ayoub benigmim
ayoub benigmim - 1 month ago

ayoub benigmim from Casablanca, Morocco is saying 2 is correct answer

Related Questions

Which method can be defined only once in a program?

  • [A] main method
  • [B] finalize method
  • [C] static method
  • [D] private method

Which of these class is super class of every class in Java?

  • [A] String class
  • [B] Object class
  • [C] Abstract class
  • [D] ArrayList class