Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Kindly check its syntex its not running properly (Urgent plz) The question was Q

ID: 3609012 • Letter: K

Question

Kindly check its syntex its not running properly (Urgent plz) The question was Question 1. Write a program named GoTooFar in which you declare anarray of five integers
and store five values in the array. Initialize a subscript tozero.Write a try block
in which you access each element of the array, subsequentlyincreasing the subscript
by 1. Create a catch block that catches the eventual
ArrayIndexOutOf BoundsException, and then print to the screen themessage,
“Now you’ve gone too far.” Save the program asGoTooFar.java in the
Chapter.15 folder of your Student Disk. _________________________________________________ /*
Chapter 15: Gone Too Far
Programmer: Rod Magnanao
Group: Learning Team A
Filename: GoTooFar.java
*/

/****************************
*Class: number
*****************************
public class GoTooFar
{
public static void main(String[ ] args)
{
int[] num = new int[5];
num[0] = 12;
num[1] = 25;
num[2] = 9;
num[3] = 33;
num[4] = 5;
try
{
for (int i = 0; i < 11; i++)
System.out.println(num[i] + " ");
}
catch (ArrayIndexOutOfBoundsException exception)
{
System.out.println("Now you've gone too far");
}
System.out.println();
}
} Kindly check its syntex its not running properly (Urgent plz) The question was Question 1. Write a program named GoTooFar in which you declare anarray of five integers
and store five values in the array. Initialize a subscript tozero.Write a try block
in which you access each element of the array, subsequentlyincreasing the subscript
by 1. Create a catch block that catches the eventual
ArrayIndexOutOf BoundsException, and then print to the screen themessage,
“Now you’ve gone too far.” Save the program asGoTooFar.java in the
Chapter.15 folder of your Student Disk. _________________________________________________ /*
Chapter 15: Gone Too Far
Programmer: Rod Magnanao
Group: Learning Team A
Filename: GoTooFar.java
*/

/****************************
*Class: number
*****************************
public class GoTooFar
{
public static void main(String[ ] args)
{
int[] num = new int[5];
num[0] = 12;
num[1] = 25;
num[2] = 9;
num[3] = 33;
num[4] = 5;
try
{
for (int i = 0; i < 11; i++)
System.out.println(num[i] + " ");
}
catch (ArrayIndexOutOfBoundsException exception)
{
System.out.println("Now you've gone too far");
}
System.out.println();
}
}

Explanation / Answer

//There is not syntax error, here is theoutput, java GoTooFar 12 25 9 33 5 Now you've gone too far