Service fun create() = Service() // Use in kotlin in another package fun main(args: Array<String>) { var s: Service? = com.exmaple.create() } // Use in Java public static final void main(@NotNull String[] args) { Service s = com.exmaple.ComponentKt.create(); } each file will generate a separate class
= "TAG" } fun helloWorld() { println(TAG) } } public final class MyClass { public static final class Companion { private final String getTAG() { return MyClass.TAG; } private Companion() { } } private static final String TAG = "TAG"; public static final MyClass.Companion Companion = new MyClass.Companion(….); public final void helloWorld() { String var1 = Companion.getTAG(); System.out.println(var1); } }
= "TAG" } fun helloWorld() { println(TAG) } } public final class MyClass { public static final class Companion { private final String getTAG() { return MyClass.TAG; } private Companion() { } } private static final String TAG = "TAG"; public static final MyClass.Companion Companion = new MyClass.Companion(….); public final void helloWorld() { String var1 = Companion.getTAG(); System.out.println(var1); } } extra method call
val TAG = "TAG" } fun helloWorld() { println(TAG) } } public final class MyClass { public static final class Companion { private final String getTAG() { return MyClass.TAG; } private Companion() { } } private static final String TAG = "TAG"; public static final MyClass.Companion Companion = MyClass.Companion(….); public final void helloWorld() { String var1 = "TAG"; System.out.println(var1); } }
{ case 0: case 1: return 1; default: return number * factorial(number - 1); } } public static final int factorialTR(int number, int accumulator) { while(true) { switch(number) { case 0: return accumulator; default: int var10000 = number - 1; accumulator *= number; number = var10000; } } }
Thread() { Thread.sleep(1000L) print(".") }.start() } } Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Thread.java:714)