The String Class




A String is a class (i.e. an object when created at runtime). However, you do not have to use new when you create a String object. A String is an object at runtime that holds a sequence of characters.

Example:

Instance variables (available to all methods)
  
   private String firstName;
   private String lastName;
   public String s = "Hello World";



Some common methods:

charAt(some int) - returns the char at the given position
indexOf(some String) - returns the index position of the String if found, otherwise returns -1
substring(start position, end position)
substring(start position)