Why double Constructor is used in Kotlin | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why double Constructor is used in Kotlin

I did not understand, why or when to use double Constructor, please explain anyone.

30th Jul 2022, 2:33 AM
Md Tausif Iqbal
Md Tausif Iqbal - avatar
1 Answer
+ 1
the double constructor is used for different variants of it, for example, there is a variable age and name age - optional, but the user may or may not enter it, double constructors are needed here.
30th Jul 2022, 8:55 AM
Костя Ан
Костя Ан - avatar