In the last post we learned how to write class, how to import packages, how to print output in java .Now by moving one step ahead , we will learn to take input from user in java.
✅ Take Input in Java -
You can take input from user using several ways . In this tutorial , we will learn to take input from user using Object of Scanner Class.
⮚ After importing package , create an Object of Scanner Class.
⮚ Now we can use Object of Scanner class i.e. sc to call methods predefined in Scanner Class to take input.
Have a Look on Different Methods for reading Different Input of Different Data-Types
⮚Go through this example to understand how to use above methods to take input from user -
Output of the Code :
If you have any queries, drop us mail 📧 or mention in comment section⮯
All the Best 👍👍👍
Happy Learning 😇😇😇
Tags:
Java