Bird
0
0

In Kotlin, which operator has higher precedence: + or ==?

easy📝 Conceptual Q2 of 15
Kotlin - Operators and Expressions
In Kotlin, which operator has higher precedence: + or ==?
AEquality (==)
BAddition (+)
CBoth have the same precedence
DDepends on the data types
Step-by-Step Solution
Solution:
  1. Step 1: Understand the operators involved

    Addition (+) is an arithmetic operator, equality (==) is a comparison operator.
  2. Step 2: Check Kotlin operator precedence

    Addition (+) has higher precedence than equality (==), so addition is evaluated first.
  3. Final Answer:

    Addition (+) -> Option B
  4. Quick Check:

    Arithmetic operators > Comparison operators [OK]
Quick Trick: Arithmetic operators run before comparison operators [OK]
Common Mistakes:
MISTAKES
  • Assuming equality is checked first
  • Thinking precedence depends on data types
  • Confusing operator categories

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes