How to create class and object in kotlin?


Warning: Trying to access array offset on false in /home3/indiakep/public_html/wp-content/plugins/dw-question-answer/inc/Template.php on line 8
All QuestionsCategory: KotlinHow to create class and object in kotlin?
chetan shidling asked 5 years ago

I need short information.

1 Answers
chetan shidling answered 5 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}”)
}