MCQs > IT & Programming > Kotlin > This code is occasionally throwing a null pointer exception (NPE). How can you change the code so it never throws as NPE? println("length of First Name = ${firstName!!.length}")

Kotlin MCQs

This code is occasionally throwing a null pointer exception (NPE). How can you change the code so it never throws as NPE? println("length of First Name = ${firstName!!.length}")

Answer

Correct Answer: Replace !!. with ?.

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Kotlin Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Kotlin Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it