Kotlin Programming Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

Let's try to understand the methods by which we were able to read input in Kotlin.

Behind the scenes, Kotlin.io uses java.io for the input-output. So println is basically System.out.println, but with additional power by Kotlin to use String templates and inline functions, which makes writing extremely simple and concise.

This is a part of the actual code from Kotlin stdlib used for Console IO:

/** Prints the given message and newline to the standard output stream. */
@kotlin.internal.InlineOnly
public inline fun println(message: Any?) {
System.out.println(message)
}