Observe the below code : String course="Java Programming"; char c=course.charAt(16); System.out.println(c); What will be the output for the above code snippet?
Answer options
A
charAt(16); System.out.println(c); What will be the output for the above code snippet?
B
StringIndexOutOfBoundsException
C
ArrayIndexOutOfBoundsException
D
Compilation error
E
g
Correct answer: StringIndexOutOfBoundsException
Explanation
Correct answer: StringIndexOutOfBoundsException.