Ver Mensaje Individual
  #4  
Antiguo 06-07-2004
santana santana is offline
No confirmado
 
Registrado: nov 2003
Posts: 1.030
Reputación: 0
santana cantidad desconocida en este momento
Hola, de nuevo.

Y ahora, para validar números, otro ejemplo.


Código:
 
 Public class validarNumeros {
 
 Public static int exceptionThrower(String error) throws
 Exception {
	 throw new Exception(error);
 }
 
 Public static void main(String args[]) throws Exception {
 	 int valorMin = 1;
	 int valorMax = 999;
 	 int valor = 1000;
 
	 valor = ( (valorMin <= valor) && (valor <= valorMax) ) 
 	 ? valor : exceptionThrower("Valor fuera del rango");
 
	 System.out.println("Valor dentro del rango ");
 }
 }
Espero que te sirva.
Saludos.
Responder Con Cita