Match the method calls to the values they return


Assuming the String s is "String", match the following method calls to the values they return.


Matching pairs
s.charAt(2)

s.endsWith("ing")

s.startsWith("str")

s.indexOf("g")

s.length( )

s.substring(3, 4)

s.toLowerCase( )

s.toUpperCase( )

Assuming that the String s is "Exception", which of the following method calls will result in an exception? (select all that apply)


1. s.charAt(-1)

2. s.charAt(0)

3. s.charAt(1)

4. s.charAt(8)

5. s.charAt(9)

6. s.charAt(10)

7. s.substring(5, 8)

8. s.substring(5, 9)

9. s.substring(5, 10)


What will be printed by the following code?

String s1 = "Hello";
String s2 = "World";
s2 = s1.toUpperCase( );
System.out.println(s1 + s2);


1. HelloHELLO

2. HelloWorld

3. HELLOHELLO

4. WORLDHELLO

5. HELLOWORLD

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Match the method calls to the values they return
Reference No:- TGS097336

Expected delivery within 24 Hours