Theory
The third road to an Android app
You have now built Android apps two ways: in Java (BCA305-02, FestConnect Mobile) and with Dart/Flutter (BCA405-02). This subject teaches a THIRD: Kotlin, the language Google now officially PREFERS for Android.
Why a third? Because Kotlin fixes Java's biggest pain points, especially the dreaded null-pointer crash, while staying fully compatible with everything Java. This subject rebuilds FestConnect Mobile in Kotlin. If you know Java well (BCA403), Kotlin will feel like Java with the rough edges sanded off. This lesson introduces the language and its tools.
Theory
Kotlin, formally
Kotlin is a modern, statically-typed programming language by JetBrains that runs on the JVM (it compiles to Java bytecode, exactly like Java in BCA403).
Its headline characteristics:
- concise: far less boilerplate than Java (no semicolons, type inference, less ceremony)
- safe: built-in null safety catches null-related errors at COMPILE time, not as runtime crashes
- interoperable: it works seamlessly WITH Java, calling Java code and libraries and being called from Java, so you can mix them
- object-oriented and functional
Because it targets the JVM and interoperates with Java, Kotlin is not a rival that abandons your Java knowledge: it BUILDS on it. Google made it the preferred Android language for these very reasons.
Practical
First Kotlin: notice what is missing
fun main() { // fun declares a function; entry point
val fest = "TechnoUtsav" // val = read-only; type INFERRED as String
var seats = 350 // var = changeable; inferred Int
seats = seats - 1 // ok: var can change
// String template: $variable inside the string
println("$fest has $seats seats") // TechnoUtsav has 349 seats
}
// Notice: no semicolons, no class needed for main, types inferred.
Theory
The IDE: IntelliJ IDEA / Android Studio
Kotlin's home IDE is IntelliJ IDEA, made by JetBrains (Kotlin's own creators), which gives first-class Kotlin support. For ANDROID specifically, you use Android Studio, which is BUILT ON IntelliJ and includes Kotlin support out of the box.
Setup is straightforward: download IntelliJ IDEA (or Android Studio for Android work), install, and create a new Kotlin project; the IDE handles the Kotlin compiler and JVM. You met Android Studio already in BCA305-02 for Java Android; the same tool now hosts your Kotlin. For pure Kotlin practice (not Android), IntelliJ IDEA Community Edition is free and ideal.
Quiz
What is a defining advantage of Kotlin over Java for Android development?
- Kotlin cannot use any Java libraries
- Kotlin has built-in null safety (catching null errors at compile time) and is more concise, while remaining fully interoperable with Java
- Kotlin runs only on iOS
- Kotlin is completely unrelated to Java and the JVM
Show the answer
Kotlin has built-in null safety (catching null errors at compile time) and is more concise, while remaining fully interoperable with Java
Kotlin's headline advantages are built-in NULL SAFETY (the compiler catches potential null-pointer errors before runtime, preventing a huge class of Java crashes) and CONCISENESS (much less boilerplate), all while remaining fully INTEROPERABLE with Java, it runs on the JVM and can use every Java library. Option A is the opposite of true: seamless Java interop is a key Kotlin feature. Option C is false: Kotlin is Google's preferred ANDROID language (JVM-based). Option D denies its JVM/Java relationship, which is central to why it was adoptable (existing Java code and skills carry over). The pitch: Java's safety and interop, minus its verbosity and null crashes.
Think first
Why learn a third Android language?
You already know Java (Android) and Dart (Flutter). Why does the industry, and this subject, add Kotlin too? Then tap.
Show the answer
Because each represents a different, real-world approach you may meet on the job. JAVA is the original, still-huge Android codebase language. KOTLIN is now Google's PREFERRED language for native Android: modern, safe, concise, and the default for new native Android projects, so it is highly employable. DART/FLUTTER is the cross-platform route (one codebase for Android AND iOS). Knowing all three makes you flexible: you can maintain legacy Java, write new native apps in Kotlin, or build cross-platform in Flutter, and choose the right tool per project. Kotlin specifically is worth learning because it is where NATIVE Android development is heading, and because its improvements over Java (null safety, conciseness) are genuinely valuable. Three languages, three approaches, one adaptable developer.
Watch out
Kotlin intro traps
Thinking Kotlin abandons Java: it runs on the JVM and interoperates fully; your Java knowledge transfers.
Expecting semicolons: Kotlin does not require them (a nice simplification).
Confusing IntelliJ and Android Studio: Android Studio is built ON IntelliJ; use it for Android, IntelliJ for pure Kotlin.
Assuming it is only for Android: Kotlin also targets the JVM generally, JavaScript, and native; Android is its most famous use.
Skipping null safety: it is Kotlin's signature feature; learn it deliberately (next lesson).
Theory
Set up; now the language
With Kotlin and its IDE ready, the next lessons teach the language itself, and since you know Java, they move fast, braking only at Kotlin's distinctive features. First up: variables, the val/var distinction, Kotlin's types, and the star of the show, NULLABLE variables and null safety, the feature that most sets Kotlin apart from Java. FestConnect Mobile's rebuild starts with solid, crash-resistant data.
Summary
Key takeaways
- Kotlin is a modern, statically-typed JVM language by JetBrains, officially preferred by Google for Android.
- It compiles to Java bytecode (like Java) and is fully interoperable with Java (uses Java libraries, mixes with Java code).
- Key traits: concise (no semicolons, type inference, less boilerplate), safe (built-in null safety), object-oriented and functional.
- Null safety catches null-related errors at compile time, preventing a major class of Java runtime crashes.
- IDE: IntelliJ IDEA (pure Kotlin) or Android Studio (built on IntelliJ) for Android.
- It is the third Android path after Java (BCA305-02) and Dart/Flutter (BCA405-02); it builds on Java, not replacing your knowledge.
- Memory hook: Kotlin is Java made concise and null-safe, on the same JVM.