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