next up previous
Next: Comments and Understandability: Dearth Up: Week 3 Previous: Method Summary

The String Class

  1. not primitive data type
  2. not really user defined (at least we didn't define it), somewhere in between: comes as addition to language.
  3. Defined as a class. Therefore Strings are objects.
  4. There are String constructors and methods just like any other class (see API)
  5. Instantiations of Strings live in object space, just like instantiations of any other object
  6. class definition is in package java.lang (see API)
  7. a package is just a collection of classes (approximate definition...)
  8. String s = ``Fred Flintstone'' is equivalent to String s = new String(``Fred Flintstone'');
  9. First form above is just a special short form created because Strings are used so much.
  10. You should know the following methods from the String class:
    1. length()
    2. toLowerCase()
    3. concat()
    4. substring()
    5. indexOf()
    6. charAt()



Chris Trendall
Copyright ©Chris Trendall, 2001. All rights reserved.

2001-12-09