What is constructor in Kotlin?

A constructor is a concise way to initialize class properties . It is a special member function that is called when an object is instantiated (created). However, how they work in Kotlin is slightly different. In Kotlin, there are two constructors: Primary constructor – concise way to initialize a class.

Read more

Is the new keyword used?

The Java new keyword is used to create an instance of the class . In other words, it instantiates a class by allocating memory for a new object and returning a reference to that memory. We can also use the new keyword to create the array object.

Read more