Reading Time: < 1 minute

Take Input from User using readLine() method

To read a line of input from the standard input streamm you can use readLine() function.

Run the above program and enter “Hello, Kotlin”.

Take Input from User using Scanner class

If you want to take input from user other than String data type, you need to use Scanner class.
You have to create of object of this class and use it to get input from the user.

Reader is an object of Scanner class.
We will use this object to get input from the user.

Do not forget to import Scanner class into the file where you are createing object.

Take integer input from user using Scanner

nextInt() method is used to take next integer from keyboard
and store it in enteredValue variable.


I hope the description was understandable and clear. But if you have still questions, then leave me comments below! 😉

Have a nice a day! 🙂



Follow and like us:

Click to rate this post!
[Total: 1 Average: 5]

Leave a comment

stay informed!

Subscribe to receive exclusive content and notifications