What is the equivalent of Java Scanner
in Kotlin?
I have used readLine()
but I'd like to know whether it's type safe or not?
You can try something like this
val scan = Scanner(System.`in`)
val n = scan.nextLine().trim().toInt()
Since "in" is a Kotlin keyword