CS Electrical And Electronics
@cselectricalandelectronics

How to create class and object in kotlin?

All QuestionsCategory: KotlinHow to create class and object in kotlin?
chetan shidling asked 3 years ago

I need short information.

1 Answers
chetan shidling answered 3 years ago

Here is the code to create class and object in Kotlin.
 
class chetanhotel
{
       var name : String = “”;
}
fun main(args: Array<String>){
println(“Hello Customers”)
var customer = chetanhotel();
customer.name = “Chetan”;
println(“My name is : “+ customer.name)
//Other method
println(“My name is : ${customer.name}”)
}