Per this link, “classes, objects, interfaces, constructors, functions, properties and their setters can have visibility modifiers. ![]() Is the equivalent of this Java code: public class Person With the exception of the names of the getter and setter functions, if you’re coming to Kotlin from Java, this Kotlin code: class Person(var firstName: String, var lastName: String) You can think of them as being like function calls: val f = Foo() New instances of classes are created without the new keyword. I show annotations and visibility modifiers at the end of this lesson. If the primary constructor does not have any annotations or visibility modifiers, the constructor keyword can be omitted: class Person(var firstName: String, var lastName: String) The primary constructor is part of the class header. What is the purpose of external keyword in Kotlin Ask Question Asked 7 years ago Modified 3 years, 6 months ago Viewed 6k times 22 What exactly is the purpose of the external keyword in Kotlin I guess it's for JNI like native in Java, but I can't seem to find any actual reference or documentation on this.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |