Java program to accept 5 integers passed as arguments while executing the class

preview_player
Показать описание
Write a program to accept 5 integers passed as arguments while executing the class. Find the average of these 5 nos. Use ArrayIndexOutofBounds exception to handle situation where the user might have entered less than 5 integers.
---------------------------------------------------------------------------------------------------------------------------
public class Test {
public static void main(String[] args) {
double avg=0;
int num;
a[i] = num;
avg += num;

}

try {
throw new ArrayIndexOutOfBoundsException();
}
else {
}
}
catch(ArrayIndexOutOfBoundsException e){
}
}
}
Рекомендации по теме