January 2018
Intermediate to advanced
434 pages
14h 1m
English
Create a Java class with a method name equal to any Kotlin keyword. I am using is as the method name, so my Java class looks as follows:
public class ASimpleJavaClass { static void is(){ System.out.print("Nothing fancy here"); }}
Now try calling that method from Kotlin code. If you are using any code editor with the autocomplete feature, it automatically encloses the method name in backticks (` `):
fun main(args: Array<String>) { ASimpleJavaClass.`is`() }
Similar is the case with other keywords in Kotlin that are qualified identifiers in Java.
Read now
Unlock full access