Next: Comments and Understandability: Dearth
Up: Week 3
Previous: Method Summary
- not primitive data type
- not really user defined (at least we didn't define it), somewhere in between: comes as addition to language.
- Defined as a class. Therefore Strings are objects.
- There are String constructors and methods just like any other class (see API)
- Instantiations of Strings live in object space, just like instantiations of any other object
- class definition is in package java.lang (see API)
- a package is just a collection of classes (approximate definition...)
- String s = ``Fred Flintstone'' is equivalent to String s = new String(``Fred Flintstone'');
- First form above is just a special short form created because Strings are used so much.
- You should know the following methods from the String class:
- length()
- toLowerCase()
- concat()
- substring()
- indexOf()
- charAt()
Chris Trendall
Copyright ©Chris Trendall, 2001. All rights reserved.
2001-12-09