Home »
MCQs »
Scala MCQs
Which variable in Scala can save memory while declaring variables?
41. Which variable in Scala can save memory while declaring variables?
- Mutable variables
- Lazy Variables
- Inherited Variables
- 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.