October 2018
Intermediate to advanced
370 pages
9h 15m
English
Let's explore how to create a Java class object in Kotlin. To do this, create a Shape.java file with three properties: height, width, and name with getters and setters:
public class Shape { private int width; private int height; public static final double PI = 3.1415; private final String name; public Shape(int width, int height, String name) { this.width = width; this.height = height; this.name = name; } public final int getHeight() { return this.height; } public final void setHeight(int value) { this.height = value; } public final String getName() { return this.name; } public final void shapeMessage() { System.out.println("Hi i am " + this.name + ", how are you doing"); }}
Creating an instance of the Java class in ...
Read now
Unlock full access