How does it work under-the-hood, when we create an instance of a Class without using ‘new’ keyword in Scala? When do we go for this approach?
Answer Posted / Namrata
In Scala, when you use the `apply` method to create an instance of a class without `new`, the application calls the companion object's apply method instead. This is typically used when working with case classes or singleton objects. It allows you to create instances in a more concise way.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers