Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started