Answer the question
In order to leave comments, you need to log in
Converting Int/String to Char in Kotlin, how to understand?
one)
var number1: Int = 5
var number2 = number1.toChar()
println(number2)
var number1: String = "A"
var number2 = number1.toChar()
println(number2)
Результат: выдает ошибку
Answer the question
In order to leave comments, you need to log in
The square means the character with code 5. To convert the digit 5 to the character '5', `Character.forDigit(number1, 10)`
In the second example, the string must not be converted to a single character. Why? And if the string does not consist of one character, then what was this method supposed to do?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question