Thursday, 6 September 2012

Consider the following code snippet. Whatr will be assigned to the variable fourthChar, if the code is executed? String str = new String(“Java”); char fourthChar = str.charAt(4);

A.     ‘a’
B.     ‘v’
C.     throws StringIndexOutofBoundsException
D.     null character

Ans: C

No comments: