February 2019
Intermediate to advanced
442 pages
11h 46m
English
Let's create a Kotlin function that simply does multiplication of two given numbers in the KotlinFile.kt file as follows:
fun multiply(a:Int, b:Int):Int{ print("Calling multiply function From Kotlin....") return a * b}
We want to call a Kotlin multiply() function into a Java class. As we know, the Kotlin compiler processes this file into a Java class, where it defines the multiply() method as a static method of the KotlinFileKt.class generated class file, so that it can be accessible with the KotlinFileKt.multiply() expression.