try { szam = Integer.valueOf(s).intValue(); } catch(NumberFormatException e) { System.out.println("Gond van konverziĆ³val"); }