Consider the following code snippet. What will be assigned to the variable fourthChar, if the code is executed?
String str = new String(“Java”);
char fourthChar = str.charAt(4);
Options
- ‘a’
- ‘v’
- throws StringIndexOutofBoundsException
- null characater
CORRECT ANSWER : throws StringIndexOutofBoundsException
Write your comments