+ 1

Can someone please explain how to use scanner in Java

6th Feb 2020, 10:33 AM
Mohak Harsh
Mohak Harsh - avatar
2 Answers
+ 4
You have it in the course. https://www.sololearn.com/learn/Java/2220/ Anyways I will try to break it down for you to understand. See everything in Java is classes and objects since it's an OOP language. Scanner sc = new Scanner(System.in); In the above line Scanner is a class and sc is a reference variable. An object of class is created using new Scanner(). The System.in means that the program needs an input either through the keyboard or any other source.
6th Feb 2020, 10:40 AM
Avinesh
Avinesh - avatar
+ 2
Thanks!!
6th Feb 2020, 10:41 AM
Mohak Harsh
Mohak Harsh - avatar