KnowledgeBoat Logo
|

Computer Applications

Which operator cannot be used with if-else statement?

  1. <=
  2. ||
  3. &&
  4. ? :

Java Conditional Stmts

14 Likes

Answer

? :

Reason — Relational operators ( <= ) and logical operators (|| and &&) can be used to test a condition as they return boolean values. Ternary operator (? :) is used to assign a value to a variable based on a condition. Thus, it cannot be used with if-else statement.

Answered By

10 Likes


Related Questions