+ 3
Scanner why system.in is used
import java.util.Scanner; class MyClass { public static void main(String[ ] args) { Scanner myVar = new Scanner(System.in); System.out.println(myVar.nextLine()); } }
5 Respuestas
+ 7
You can simply understand by this that,
'System.out' (System.out.print) is used to print (to give)
Conversely, 'System.in' is used to accept (to take) values.
+ 3
System is a class in the java.lang package.
System.in is an InputStream which is typically connected to keyboard input of console programs. System.in is notused as often since data is commonly passed to a command line Javaapplication via command line arguments
https://docs.oracle.com/javase/7/docs/api/java/lang/System.html
+ 3
I'm also new to java, so don't mind me if I made some mistakes.
+ 1
https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
Scanner is class that enables you to take user input. As you can see in this page, it can be file, user input from keyboard etc.
System.in is parameter for Scanner constructor that indicates keyboard input.
+ 1
Its accessing the System class, the out method (default keyboard input) and the println method.