What is the difference between 'val' and 'lazy val' in Scala? What is Eager Evaluation? What is Lazy Evaluation?
Answer / 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 |
Explain how to create arrays?
What do you understand by an implicit parameter in scala ?
What is pattern matching?
What do you mean by “type inference” in scala?
What do you mean by ofdim in scala?
What is option/some/none design pattern in scala?
What is exception handling in scala?
What is file handling in scala?
Is scala worth learning?
What is the function parameter with a default value in scala?
What is the queue in the scala collection?
What is list in scala collection?