import java.util.Scanner; class MyClass { public static void main(String[ ] args) { Scanner myVar = new Scanner(System.in); System.out.println(myVar.nextLine()); } } | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

import java.util.Scanner; class MyClass { public static void main(String[ ] args) { Scanner myVar = new Scanner(System.in); System.out.println(myVar.nextLine()); } }

plzz explained it everything...

12th Oct 2016, 6:53 AM
Javed
Javed - avatar
6 ответов
+ 3
As far as i understand your question,you wanted to know the meaning of each of the code above. 1.import java.until.scanner-it import the scanners method in simple words, it enables you to use scanner method in your program. 2.class- create a class in which all the statements present . 3 Public static void main()- it create a main method it is very important to create a main method in the program.( actually in this statement public means this method is accessible for all functions or something like that, also there's some other meaning of static And void best I am not going to elaborate because you are a beginner and that will only confuse you now,so digest the simple meaning for now). 3.scanner- it is used for getting user input 4.system.out.println- this shows output(simple for now)
13th Oct 2016, 10:17 AM
Shashank Kumar
Shashank Kumar - avatar
+ 2
scanner(system.in) is used to read user input from keyboard
12th Oct 2016, 4:28 PM
ajim
0
Please explain your question clearly so that we can help you better.
12th Oct 2016, 10:51 AM
Mark Ian Pamintuan
Mark Ian Pamintuan - avatar
0
what is the work of 'import java.until.scanner' in this program?
12th Oct 2016, 11:33 AM
Javed
Javed - avatar
0
The import statement loads the classes (methods etc.) for the specific Java library from the Java API. In your example its java.util.Scanner for user (console) input.
12th Oct 2016, 4:09 PM
Re4LyZed
Re4LyZed - avatar
0
As far as i understand your question,you wanted to know the meaning of each of the code above. 1.import java.until.scanner-it import the scanners method in simple words, it enables you to use scanner method in your program. 2.class- create a class in which all the statements present . 3 Public static void main()- it create a main method it is very important to create a main method in the program.( actually in this statement public means this method is accessible for all functions or something like that, also there's some other meaning of static And void best I am not going to elaborate because you are a beginner and that will only confuse you now,so digest the simple meaning for now). 3.scanner- it is used for getting user input 4.system.out.println- this shows output(simple for now)
4th Mar 2020, 2:06 AM
Abdurrazzaq
Abdurrazzaq - avatar