Using any application of your choice, write a Java program named MoreElements that produces the following output:

Top 10 Second year IT students
Please enter the position of the student whose name you want displayed: 7
The name of the student in position number 7 is Tshepiso Rikotso.
Please enter the position that you want displayed: 13
Error message

must haves:
Declare an array of 10 names;
Write a try block;
Create a catch block;
Include a finally block.

import java.util.Scanner;

class MoreElements {
public static void main(String[] args) {

String[] names = {"John", "Sarah", "David", "Emily", "Michael", "Jessica", "Tshepiso Rikotso", "Dylan", "Sophia", "Connor"};

System.out.println("Top 10 Second year IT students");

Scanner input = new Scanner(System.in);

try {
System.out.print("Please enter the position of the student whose name you want displayed: ");
int position = input.nextInt();

// Subtract 1 from the position since arrays are 0-indexed
String studentName = names[position - 1];
System.out.println("The name of the student in position number " + position + " is " + studentName + ".");

System.out.print("Please enter the position that you want displayed: ");
position = input.nextInt();

// Subtract 1 from the position since arrays are 0-indexed
studentName = names[position - 1];
System.out.println("The name of the student in position number " + position + " is " + studentName + ".");

} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Error message");
} finally {
input.close();
}
}
}