email me at borlaj@portlandschools.org
notes previous (09/07/06) submit the dump links  
 

Strings (lines of text) [ ie "My name is Jeff"] - API HERE

- String is an object (a predefined class). This means it has special features, like being able to tell length and comparison features

- to declare we are going to use the same way we declared integers:

String myFirstName="Jeff";
String myLastName="Borland";

(note- String is capitalized case, thats b/c it is not primitive data.)

 

String myWholeName = myFirstName + " " + myLastName; to concate strings (bring together, we use +)

 

Strings can be manipulated using special methods:

ie:

 

myFirstName.length() returns the value 4

myFirstName.charAt(2) would return the letter f (note: J is letter 0 and so on, in programming you start at 0)

 

 

There are lots of other methods for strings in the API here.