Good afternoon! After looking and asking for opinions I have obtained the two ways you can. It only works, if the user inserts a number . Highlight, if you insert letter / character IT DOES NOT WORK .
short n;
do {
System.out.println("Escribir un número entre 11 i 90");
n = ss.nextShort();
if (n >= 10 && n <= 90) {
break;
} else {
System.out.println("Valor introducido incorrecto");
System.out.println("Vuelva introducir nu número");
}
} while (true);
In this case you can customize tell the user if the number is not between 10 and 90 , customize the message "return" (else), with "Value entered incorrect".
Note: I use "short" and not int, because the user asks me for a 16bit number.
The following is more " short ", but it does not let you customize the message if it is a else . It just says "Write 10 and 90", but it works.
short n;
do{
Scanner ss = new Scanner(System.in);
System.out.println("Escribe 10 i 90");
n = ss.nextShort();
System.out.println("tu número es:" +n);
}while (n < 10 || n >90);