OneCompiler

Class in Kotlin

please tell me how can I add in kotlin page new class page. I need write a class in Kotlin.
thank you.

1 Answer

1 year ago by

// Define the class
class Person(val name: String, val age: Int) {

// A method inside the class
fun introduce() {
    println("Hello, my name is $name and I am $age years old.")
}

}

1 year ago by Scintillate