Which variable in Scala can save memory while declaring variables?

41. Which variable in Scala can save memory while declaring variables?

  1. Mutable variables
  2. Lazy Variables
  3. Inherited Variables
  4. None of these

Answer: B) Lazy Variables

Explanation:

Using the lazy keyword, you can halt the initialization of the variable until the time it is first used or accessed in the code.

Comments and Discussions!

Load comments ↻






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