System.out.print("Alap: "); String alapStr = System.console().readLine(); int alap; try{ alap = Integer.parseInt(alapStr); }catch(NumberFormatException ex){ System.err.println("Csak egész szám adható meg!"); }