how to read line in java from console code example Example: java taking console input String str = System.console().readLine();