Ask Questions?

View Latest Questions

Advertisement


 
 

Java: String Exercise 1b
Posted on: April 17, 2011 at 12:00 AM
This page discusses - Java: String Exercise 1b

Java: String Exercise 1b

Name ______________________

Assume the following:

String a = "alpha";
String w = "Auf Wiedersehen";

Give the values of the following expressions.

1____________a.length()
2____________a.substring(3)
3____________a.substring(2,3)
4____________"Special".substring(3).substring(1)
5____________w.substring(0, 3).toUpperCase()

6____________w.indexOf("e")
7____________w.lastIndexOf("e")
8____________" Apples " + 1 + 2
9____________1 + 2 + " Apples " + 1 + 2
10____________w.substring(w.indexOf(" ") + 1).toUpperCase()
Advertisement


DMCA.com