October 2019
Intermediate to advanced
434 pages
11h 54m
English
The following snippet illustrates a simple Java class with two fields and associated getters:
// basic Java classpublic class Developer { private String name; private String favoriteLanguage; public Developer(String name, String favoriteLanguage) { this.name = name; this.favoriteLanguage = favoriteLanguage; } public String getName() { return name; } public String getFavoriteLanguage() { return favoriteLanguage; }}
This Developer class is representative of any simple model object representing a person. Even though Developer is implemented in Java, we can still use it from Kotlin, as demonstrated in the following snippet:
// Kotlin function creating a new Developer object and accessing the ...Read now
Unlock full access