Kotlin Input : It is used to flow byte streams from user input such as keyboard to system's main memory. There are two ways in which we can take input from the user.
1. readLine() : It takes the input from the user as a string
var line = readLine()
2. Scanner Class :
var scanner = Scanner(System.'in')
var number = scanner.nextInt()
Kotlin output : It is used to display output on the console.
1. print() : This simply prints the message which is inside double quotes.
2. println() : This print s the message and moves to the next line.
NOTE : If we see the implementation of print() and println() function, internally the implement System.out.print() and System.out.println() from java respectively.
Comments
Post a Comment