Question: Question 1: Write a programme that will create an int array of size 10. The programme should assign user input values iteratively until the user

Question 1: Write a programme that will create an int array of size 10. The programme should assign user input values iteratively until the user types in -1. However, if user enters more than 10 int values attempting to add these to a non- existing index will lead to an ArraxIndexOutOfBoundsException Exception. Your programme should handle this exception by printing Array is now full. and exit the loop. It should then print all the elements of the array to check the results. The output of the programme may look as follows. java ArrayInit Enter int values to add to the array ( -1 to stop): 5 6 7 4 5 -1 Array elements are: 5 6 7 4 5 0 0 0 0 0 java Arraxinit Enter int values to add to the array (-1 to stop): 2 3 4 Array is now full. Array elements are: 2 3 4 5 4 8 3 5 6 7 Process finished with exit code 0 java ArrayInit Enter int values to add to the array ( -1 to stop): 34 57 23 1 56 7 9 3 2 5 67 8 2 3 4 55 6 7 8 8 9 3 5 6 Array is now full. Array elements are: 34 57 23 1 56 7 9 3 2 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
