Questions

Kotlin questions

Choose a question page, learn the concept, then test your understanding with a quiz.

Start a New Activity with Intent in Kotlin Android

Learn how to start another Android Activity in Kotlin using Intent, class references, explicit navigation, and correct manifest setup.

kotlinandroidandroid-intentandroid-activity

Static Extension Methods in Kotlin: What’s Possible and How to Do It

Learn how Kotlin extension functions work, why static extension methods on classes are not supported, and practical alternatives to use instead.

kotlinstatic-methods

Static Methods and Variables in Kotlin: companion object Guide

Learn how Kotlin companion objects replace Java static methods and variables, with singleton patterns, examples, common mistakes, and a mini project.

kotlinjavastatic-methods

String Concatenation in Kotlin: Using +, Templates, and StringBuilder

Learn how to concatenate strings in Kotlin with the + operator, string templates, and StringBuilder, including practical examples and pitfalls.

kotlinstring

Swift `if let` Equivalent in Kotlin: Safe Null Handling with `let`, `?.`, and `if`

Learn the Kotlin equivalent of Swift `if let` for nullable values using safe calls, `let`, Elvis, and null checks with clear examples.

kotlin

Test Expected Exceptions in Kotlin with JUnit

Learn to test expected exceptions in Kotlin with JUnit 4’s expected property and JUnit 5’s assertThrows, plus reliable testing patterns.

kotlinunit-testingtestingexception

Understanding the Kotlin Plugin Version Warning in Gradle for Android and Java Modules

Learn why Android Studio shows a Kotlin plugin version warning in Gradle, even when versions match, and how to handle it correctly.

kotlinandroidandroid-studiogradle

Understanding the `out` Keyword in Kotlin Generics

Learn what the `out` keyword means in Kotlin generics, how covariance works, and when to use `out T` with simple examples.

kotlingenerics

Updating MutableLiveData from Coroutines in Kotlin: setValue vs postValue

Learn why MutableLiveData.setValue fails on background threads in Kotlin coroutines and how to update LiveData safely in Android.

kotlinandroid-livedatakotlin-coroutines

Use @Parcelize Without kotlin-android-extensions in Kotlin

Learn how to migrate from deprecated kotlin-android-extensions Parcelize support to the kotlin-parcelize Gradle plugin and kotlinx.parcelize.Parcelize import.

kotlinandroidannotationsparcelable

Use Gson TypeToken with Generic Lists in Kotlin

Learn how to deserialize generic lists with Gson TypeToken in Kotlin, fix constructor access errors, and build reusable JSON helpers.

kotlingenericsgsontypetoken

What `suspend` Means in Kotlin Coroutines

Learn what `suspend` means in Kotlin coroutines, which coroutine is suspended, and how suspension differs from blocking threads.

kotlinasync-awaitkotlin-coroutinescoroutine

What the Elvis Operator Does in Kotlin

Learn how Kotlin's Elvis operator (?:) works, how it handles null values, and how it compares to an if expression.

kotlin

What the `by` Keyword Does in Kotlin: Delegated Properties Explained

Learn what the `by` keyword means in Kotlin, especially for delegated properties in Android and Kotlin apps, with examples and common mistakes.

kotlindelegateskeyword

What to Use Instead of Deprecated Handler() in Android Kotlin

Learn why Handler() is deprecated in Android Kotlin and how to replace it with Handler(Looper), coroutines, or view.postDelayed().

kotlinjavaandroidandroid-handler

When to Use Inline Functions in Kotlin

Learn when to use inline functions in Kotlin, how lambdas are compiled, and why inline can improve higher-order function performance.

kotlinfunctioninline-functions

When to Use run, let, apply, also, and with in Kotlin

Learn when to use Kotlin scope functions run, let, apply, also, and with with clear examples, comparisons, mistakes, and a mini project.

kotlin

Why Kotlin Smart Cast Fails on Mutable Properties: var, Null Safety, and Elegant Fixes

Learn why Kotlin smart cast fails on mutable properties and how to fix it safely using local vals, safe calls, and null handling.

kotlin

fold() vs reduce() in Kotlin: Difference, Examples, and When to Use Each

Learn the difference between fold() and reduce() in Kotlin with simple examples, execution steps, common mistakes, and when to use each.

kotlinreducefold

launch/join vs async/await in Kotlin Coroutines

Learn the difference between launch/join and async/await in Kotlin coroutines, when to use each, and common mistakes beginners make.

kotlinasynchronouscoroutinekotlin-coroutines

Page 8 of 9 - 162 questions