Home »
MCQs »
Scala MCQs
Which is valid to method to increase value of variable by one?
52. Which is valid to method to increase value of variable by one?
- a++
- ++a
- a += 1
- All of these
Answer: C) a += 1
Explanation:
The Scala programming language doesn't support unary operators (++ or --). In Scala, the binary operators are used to increment and decrement an integer.