How do we declare a private Primary Constructor in Scala? How do we make a call to a private Primary Constructor in Scala?
Answer / Mohd Junaid Siddiqui
To declare a private primary constructor, you simply add the 'private' keyword before 'def'. To call a private primary constructor from another constructor (secondary constructor), use the 'super' keyword. Here is an example: class MyClass(private def this(name: String)) { ... }
| Is This Answer Correct ? | 0 Yes | 0 No |
If I want to become a Fullstack Scala Developer, which technology stack I should learn?
What is final in scala?
What is the breakable method in scala?
Mention the difference between an object and a class ?
What is Scala anonymous function?
What is REPL in Scala? What is the use of Scala’s REPL? How to access Scala REPL from CMD Prompt?
What is Either in Scala? What are Left and Right in Scala? Explain Either/Left/Right Design Pattern in Scala?
What is the latest version of scala?
What are the popular JVM Languages available now?
What is apply method in Scala? What is unapply method in Scala? What is the difference between apply and unapply methods in Scala?
Explain what is unit in scala?
What is pattern matching?