Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
Kotlin
/
Null safety
An unannotated Java method returns a platform String type. Which first step keeps the Kot…
from Null safety
Kotlin 2.4.10
intermediate
1 min
An unannotated Java method returns a platform String type. Which first step keeps the Kotlin boundary honest when the implementation is not trusted?
Assign it to String? and validate or normalize it.
Assign it to String and rely on compiler inference.
Append !! so later calls can omit safe calls.
Cast it with as String because platform types are always non-null.
Check
Ask AI about this kata
Report an error
previous kata
Which type allows both the list itself and each element to be null?
Quiz
next kata
What does this program print?
Predict the output
A new version is available
Reload