Puede crear excepciones para manejar posibles problemas en el código.
public String getValor(int indice) throws IndexOutOfBoundsException {
if (indice < 0 || indice > 100) {
throw IndexOutOfBoundsException();
}
}
public String getValor(int indice) throws IndexOutOfBoundsException {
if (indice < 0 || indice > 100) {
throw IndexOutOfBoundsException();
}
}
0 comentarios:
Publicar un comentario