using try and catch is an easy, but on the other hand definitive way to catch your error. your program will not crash, but if you make a wrong input, your program won't ask for any more.
for instance:
int numbers[] = new int[5];
try{
for(int count = 0; count < 5; count++){
numbers[count] = readNumber();
}
}
catch(Excetion ex){
// this is the part that would happen if an invalid value (maybe a
// String Object) was entered in case of a number.
}
everything behind the catch clause is runned both when an error occured, and when no error occured. if you want now to add all the numbers to one huge sum, you must remember that there is a possibility that not all the elements of the array contain the values you want them to contain