Write a Java program to insert an element (at specific position) into an array. Initialize the array and take the specific position and value to be inserted from user. If user enters a position that is not index, then ask the user to enter correct position. Sample Array A = [1, 2, 3, 4, 5, 6] Sample Output: Enter the value to be inserted: 8 Enter the position where you want to insert the value: 4 The array afier inserting element is: 1 2 3 8 4 5 6
Write a Java program to insert an element (at specific position) into an array. Initialize
the array and take the specific position and value to be inserted from user. If user
enters a position that is not index, then ask the user to enter correct position. Sample Array A = [1, 2, 3, 4, 5, 6] Sample Output: Enter the value to be inserted: 8 Enter the position where you want to insert the value: 4 The array afier inserting element is: 1 2 3 8 4 5 6