Se non ti interessa la retrocompatibilita', Java 1.5 ha introdotto la classe Scanner per leggere da "standard input".