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 |
How do you prove that by default, Case Object is Serializable and Normal Object is not?
What are the differences between Array and ArrayBuffer in Scala?
What is REPL in Scala? What is the use of Scala’s REPL? How to access Scala REPL from CMD Prompt?
What is seq in scala collection?
What are left and right in scala?
What is PreDef in Scala?
Explain the difference between function and method in scala?
What is currying in scala?
What is a stream in scala?
What do you mean by implicit parameters?
What is repl in scala?
What is a ‘Scala map’?