Compiler

is kotlin compiled the same way as java or different? If not, what is different from java?

I’m not sure what you’re asking here.

Will the Java compiler compile Kotlin code? No. Kotlin is a different language, with its own syntax and features. The Java compiler only understands Java source code. The Kotlin compiler is a separate program that only understands Kotlin source code.

Do both compilers work in a similar way? Yes. They both accept source code file(s) in the appropriate language, along with existing libraries (as .class and/or .jar files), and generate Java bytecode in the form of .class files. The resulting classes can then be run in any JVM.

The only practical difference when running is that Kotlin programs will need access to some Kotlin runtime libraries in addition to the standard Java libraries. You can either specify them explicitly, or use the kotlin program to start the JVM, as that does so automatically.

— That’s true of Kotlin/JVM, anyway. Kotlin also has compilers which generate JavaScript, and native executables. Those aren’t related to Java.

also kotlin compiler is splitted in 2: frontend and backend compiler which is not the case of javac. this enable easier multitarget compilation (compile to js/native/…)

I don’t think that’s relevant, as the Kotlin compiler’s internal organisation is entirely transparent to its users. (And I’d be surprised if the most Java compilers weren’t structured in a similar way.)