How to do press enter to continue in java

Java
System.out.println("Press enter to continue");
try{System.in.read();}
        catch(Exception e){}
Source

Also in Java: