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 |
Difference between Scala’s Inner class and Java’s Inner class?
what are the features of scala?
What is akka in scala?
What are the advantages of scala over java (java 8)?
What is scala and why it is used?
What is a class in scala?
What is try catch in scala?
What are option, some and none in scala?
Differentiate between null, nil, none and nothing?
What is the current latest version of scala? What is the major change or update in scala 2.12?
What is the use of ‘???’ in Scala-based Applications?
What are the available Unit Testing, Functional Testing and/or BDD Frameworks for Play and Scala Based applications?