MCQs > IT & Programming > Kotlin > You have created an array to hold three strings. When you run the code bellow, the compiler displays an error. Why does the code fail? val names = arrayOf(3) names[3]= "Delta"

Kotlin MCQs

You have created an array to hold three strings. When you run the code bellow, the compiler displays an error. Why does the code fail? val names = arrayOf(3) names[3]= "Delta"

Answer

Correct Answer: Arrays use zero-based indexes. The value 3 is outside of the array's bounds

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