Discussion :: Exception Handling - General Questions (Q.No.4)
|Jitendra Patil said: (Jul 13, 2012)|
|As a first statement in catch block will be executed first then the last statement after catch block will definitely execute.|
|Ramakrishna said: (Dec 15, 2012)|
|Given all statements are in order. Whatever we given the console statements those will be executed definitely.|
|John said: (Jan 11, 2013)|
|Because it will be handled by default exception handler.|
|G.Durga said: (Jun 17, 2013)|
|Generally in arrays index starts from '0'.
Here we declared an array named a with size 5.
So it have the capacity to contain only 6 elements.
So it doesn't take in a value, but we are passing value 6, so the control goes to catch block. Then remaining statements will be executed. Finally the result come as 'index out of bounds Remaining Program'.
|Satham said: (Dec 2, 2013)|
|Arrays are zero based index types.
So that array will have the index as  only.
But if we assign a as the index, it will exceed the actual array index (5). So that catch block will be executed and then the following statement is also be executed.
So that the result would be "Index out of bounds Remaining program" only.
|Sujoy Mondal said: (May 20, 2015)|
|Array Index a = [0, 1, 2, 3, 4, 5].
But Index is 6. So a[index] = val.
=> a = 44.
Index crossed the define array max index (define array index max = 5).
So result Index out of bounds.
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.