Console log java

try(Scanner scan=new Scanner(System.in)){
	// In java, read from console
	String inputString=scan.nextLine();
	//In Java, write to console
  	System.out.println(inputString);
}