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?

  1. a++
  2. ++a
  3. a += 1
  4. 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.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.