What is Primary Constructor? What is Secondary or Auxiliary Constructor in Scala?
Answer / Ranjit Maurya
The primary constructor of a class is the one that takes parameters for initializing instance variables. In Scala, if no constructors are explicitly defined, a default primary constructor with no arguments will be automatically generated. A secondary or auxiliary constructor is a constructor that calls another constructor, usually the primary constructor, to initialize an object.
| Is This Answer Correct ? | 0 Yes | 0 No |
Mention the types of variables in scala?
What are the major differences between Scala’s Auxiliary constructors and Java’s constructors?
What is Scala anonymous function?
What is the Relationship between equals method and == in Scala? Differentiate Scala’s == and Java’s == Operator?
What is anonymous (lambda) function in scala?
Explain what is unit in scala?
What do you understand by an implicit parameter in scala ?
What does sortedset in scala collection?
What is the access modifier in scala?
What is the difference between 'val' and 'lazy val' in Scala? What is Eager Evaluation? What is Lazy Evaluation?
Is scala better than java?
Why is scala faster than java?