+ 1
Can someone please explain how to use scanner in Java
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.
+ 2
Thanks!!