1try(Scanner scan=new Scanner(System.in)){
2 //read from console
3 String textRead=scan.nextLine();
4 //write to console
5 System.out.println(textRead);
6}
1# comile Java class
2javac YourClass.java
3# run compiled Java class
4java YourClass
5# run Java class directly
6java YourClass.java
7# run JAR
8java -jar YourJar.jar