5. Will the given program go to the catch block even after the presence the return statement in the try block. public class Main { public static void main(String[] args) { try { int[] arr = {1, 2, 3, 4}; System.out.println(arr[8]);
5. Will the given program go to the catch block even after the presence the return statement in the try block. public class Main { public static void main(String[] args) { try { int[] arr = {1, 2, 3, 4}; System.out.println(arr[8]);
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
![5. Will the given program go to the catch block even after the presence of
the return statement in the try block.
public class Main {
public static void main(String[] args) {
try {
int[] arr = {1, 2, 3, 4);
System.out.println(arr[8]);
return;
} catch (Exception ex) {
System.out.println("Exception thrown");
}
}
}](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F694c9e9f-52cf-453a-8a4e-f5f414ae86da%2F6b48f9a0-36f5-4428-8cbd-1c103354261e%2F6nniw2f_processed.jpeg&w=3840&q=75)
Transcribed Image Text:5. Will the given program go to the catch block even after the presence of
the return statement in the try block.
public class Main {
public static void main(String[] args) {
try {
int[] arr = {1, 2, 3, 4);
System.out.println(arr[8]);
return;
} catch (Exception ex) {
System.out.println("Exception thrown");
}
}
}
Expert Solution

Step 1
will the given program go to the catch block even after the presence of the return statement in the try block.
public class Main {
public static void main(String[ ] args) {
try{
int[ ]arr={ 1,2,3,4 },
System.out.println(arr[8]);
return;
}catch(Exception ex) {
System.out.println( "Exception Thrown" );
}
}
}
Step by step
Solved in 2 steps
