Calling Java code in Kotlin

In this section, we will learn how to use Java code in a Kotlin file. For the sake of simplicity, begin by creating a package and adding both Java and Kotlin files in one place, as we know that Kotlin makes it possible to keep both Java and Kotlin files in one project. So, we have two Java classes, called CallJava and Shape, and in the same folder we have one Kotlin file, called FromKotlin:

Let's start with the Java static variable and function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.198.94