String s = "123y";try { int = Integer.parseInt(s);}catch (NumberFormatException ex) { System.out.prinln("Keine Zahl");}