How are Primary Constructors different from Secondary Constructors ?
Answer / Narendra Kumar Tiwari
Primary Constructors are the regular constructors declared in the class, and they have the same name as the class. They can contain initializer blocks to initialize properties. Secondary Constructors are declared using the constructor keyword inside another constructor and can have unique names.
| Is This Answer Correct ? | 0 Yes | 0 No |
How many constructors are available in Kotlin?
Why you should shift from Java to kotlin?
What is the difference between object { } block and companion object { } code block in Kotlin?
How to handle null exceptions in Kotlin programming?
List the number of constructors available in Kotlin?
Give me name of the extension methods Kotlin provides to java.io.File
Does Kotlin allow macros?
How are Primary Constructors different from Secondary Constructors ?
What is kotlin’s null safety?
Name the extension methods Kotlin provides to java.io.File?
What is the role of open keyword in Kotlin?
What do you mean by kotlin string interpolation?