+ 4

How the command line "import java.util.Scanner" affects my hole code?

I don't really understand this "Scanner" method and its function. What is the purpose of create this command line ?

13th Apr 2017, 2:26 AM
Mr.Seven
Mr.Seven - avatar
5 ответов
+ 24
It doesn't make any changes in your code until you declare a Scanner. The main use of Scanner is to get user input. If you are unable to understand Scanner, try to analyze other java codes made by other users so that you can get idea about what it is. https://code.sololearn.com/c4D5bso3Tsip/?ref=app https://code.sololearn.com/c4OEP6tooV9I/?ref=app https://code.sololearn.com/cnnABvV231bA/?ref=app
4th May 2017, 3:14 AM
Biraj Patel
+ 6
You can import it and then make a user input, it doesn't affect your code however.
13th Apr 2017, 2:27 AM
MrCoder
MrCoder - avatar
+ 6
in laymans terms: the scanner is not in all programs, and you did not create the code. So you have to import it from the java library (add the code) to your program in order to use the code. You could just create your own scanner object, then you wouldn't need to import it. Good luck with that though.
13th Apr 2017, 2:50 AM
Rrestoring faith
Rrestoring faith - avatar
+ 3
when it required to accept input from user then use Scanner class. import it and use its methods. scanner is use only for accept input from user
13th Apr 2017, 3:37 AM
Mayur Chaudhari
Mayur Chaudhari - avatar
+ 1
the command line will enable the user to input data directly using the keyboard or import them from the file ....so importing will not have any other effects to the code
13th Apr 2017, 7:18 AM
Lilian Charles
Lilian Charles - avatar