What is the difference between 'val' and 'lazy val' in Scala? What is Eager Evaluation? What is Lazy Evaluation?
Answer Posted / Amit Singh Bisht
In Scala, 'val' is a value that is initialized when it is defined. This process is known as Eager Evaluation. On the other hand, 'lazy val' initializes the value only when it is first accessed or needed. This is called Lazy Evaluation.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers