Suppose s is a string with the value "java". What will be assigned to x if you execute the following code?

char x = s.charAt(4);

a. 'a'
b. 'v'
c. Nothing will be assigned to x, because the execution causes the runtime error StringIndexOutofBoundsException.

c The string index starts from 0 and the last index is s.length() - 1 . s.charAt(4) is out of bounds.

Computer Science & Information Technology

You might also like to view...

All configuration information needed by the operating may be located in which of the following?

A) System folder B) Configuration file C) Registry hives D) Autoexec.bat file

Computer Science & Information Technology

What kind of media is used by 100GBASE-SR10 Ethernet?

a. UTP b. MMF c. STP d. SMF

Computer Science & Information Technology