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
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