Kotlin Language Essentials for Android
var vs val, null safety, data classes, when expressions, extension functions, scope functions and fundamental Kotlin concepts
24 面接問題·
Junior
1What is the difference between 'var' and 'val' in Kotlin?
1
What is the difference between 'var' and 'val' in Kotlin?
回答
'var' declares a mutable (modifiable) variable, while 'val' declares an immutable (read-only) variable. It's recommended to use 'val' by default to promote immutability and avoid bugs.
2What does the '?' operator after a type mean in Kotlin?
2
What does the '?' operator after a type mean in Kotlin?
回答
The '?' operator indicates that the variable can contain null. For example, 'String?' means the variable can be a String or null. This is the basis of Kotlin's null safety system.
3What does the '!!' operator do in Kotlin?
3
What does the '!!' operator do in Kotlin?
回答
The '!!' operator (not-null assertion) forces the compiler to treat a nullable value as non-null. If the value is null, a NullPointerException is thrown. Only use when you're certain the value is not null.
4
What is the Elvis operator '?:' used for in Kotlin?
5
What is a data class in Kotlin?
+21 面接問題
その他のAndroid面接トピック
Android Fundamentals
Junior
24問Android UI and Resources
Junior
30問Android Lifecycle
Junior
30問Android Navigation
Junior
26問Android Data Management
Junior
29問Android Networking
Junior
29問Android Testing
Junior
28問Android Gradle
Junior
26問Room Database
Mid-Level
25問Background Work
Mid-Level
18問Jetpack Compose
Mid-Level
28問Permissions and Device Features
Mid-Level
21問Firebase for Android
Mid-Level
23問Android MVVM Architecture
Mid-Level
18問Advanced Android Networking
Mid-Level
13問Kotlin Collections and Operators
Mid-Level
20問Kotlin Coroutines and Flow
Mid-Level
20問Android Dependency Injection
Mid-Level
15問Android MVI Architecture
Mid-Level
17問Android Clean Architecture
Senior
21問Android Compose Advanced
Senior
17問Android Performance and Monitoring
Senior
13問Android Security and Privacy
Senior
18問Android CI/CD and Release
Senior
15問Android UX and Form Factors
Senior
18問Android Testing Advanced
Senior
18問