Why question mark (?) is used while assigning string to null? In Kotlin


Warning: Trying to access array offset on false in /home3/indiakep/public_html/wp-content/plugins/dw-question-answer/inc/Template.php on line 8
All QuestionsCategory: KotlinWhy question mark (?) is used while assigning string to null? In Kotlin
chetan shidling asked 5 years ago

fun main(args : Array<String>)
{
var str : String? = null
}

1 Answers
chetan shidling answered 5 years ago

It is used to assign null to string. If we assign null to string without using a question mark then it will show an error.