Skip to content
Learn Netverks

Lesson

Step 4/36 11% through track

jvm-kotlin-preview

JVM Kotlin preview

Last reviewed Jun 1, 2026 Content v20260601
Track mode
server_compiled
Means
Compiled runner
Reading
~2 min
Level
beginner

This lesson

This lesson teaches JVM Kotlin preview: the syntax, patterns, and safety habits you need before advancing in Kotlin.

Teams still ship JVM Kotlin preview in Kotlin codebases—skipping it leaves gaps in debugging and code reviews.

You will apply JVM Kotlin preview in contexts like: Android apps, Spring services, and shared KMP modules.

Write Kotlin in main.kt with fun main(), click Run on server—the dev runner kotlinc compiles to a JVM jar and java runs it; use println for output (requires JDK + kotlinc; LEARNING_RUNNER_ENABLED=true).

At the start of the track—complete before lessons that assume you understand the compiled playground.

Most Kotlin in this track targets the JVM—the same virtual machine as Java. Kotlin source compiles to .class files; you can mix Kotlin and Java in one Gradle or Maven project.

Key JVM concepts

  • fun main() in main.kt becomes class MainKt with a static entry point
  • Kotlin types map to Java types—Int is int or Integer at boundaries
  • @JvmStatic, @JvmOverloads, and @JvmName tune Java-facing APIs
  • JDK classes are callable from Kotlin without wrappers

Multiplatform note

Kotlin also compiles to JavaScript and Native (KMP). This track emphasizes JVM patterns; Android teaser links to local Gradle workflows with the Android SDK.

Important interview questions and answers

  1. Q: Can Java call Kotlin code?
    A: Yes—Kotlin generates Java-compatible bytecode; expose top-level functions with @file:JvmName or put APIs on objects with @JvmStatic.
  2. Q: What runs Kotlin on the JVM?
    A: The Kotlin compiler (kotlinc) emits bytecode executed by the JVM—same as javac output for Java.

Self-check

  1. What JVM class name does main.kt typically produce?
  2. Can Kotlin use existing Java libraries?

Tip: main.kt becomes MainKt—use @JvmStatic when Java callers need static methods.

Interview prep

Can Java call Kotlin?

Yes—use @JvmStatic, @JvmOverloads, and @file:JvmName for ergonomic Java APIs.

What runs Kotlin on JVM?

kotlinc emits bytecode executed by the JVM—like javac for Java.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Bytecode like Java?
  • Kotlin stdlib role?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump