Ma non puoi usare nextLine() e convertire con parseInt()? Se non lo č gestisci l'eccezione.
Codice:
boolean integer = false;
do
{
try {
String s = tastiera.nextLine();
int n = Integer.parseInt(s);
integer = true;
System.out.println(n);
} catch(NumberFormatException e) {
System.err.println("Non hai inserito un numero. Riprova");
}
} while(!integer);