hi,
One of the question from a mock
test of examguide online is ..........
class C {
public static void main (
String[] a1) {
System.out.print(a1[1] + a1[2] + a1[3]);
}}
What is the result of attempting to compile and run the program?
java command A B C
1.Prints: ABC
2.Prints BC and Runtime Exception
3.Prints: BCD
4.Runtime Exception
5.None of the above
The given answer for this Answer 2(array index outof bounds exception only till a1[2] is allowed.)
but I think the answer for this 4.runtime exception. when i tried to execute array out of bound exception has arrivied, with no output as BC. So how can one justify the answer to be no.2? please explain.