Java Reference
In-Depth Information
Appendix C contains an abbreviated version of the API documentation. You may find
the abbreviated documentation easier to use than the full documentation. It is fine if
you rely on the abbreviated documentation for your first programs, but you should
eventually move on to the real thing.
52
53
S ELF C HECK
23. Look at the API documentation of the String class. Which method
would you use to obtain the string Ðhello, world!Ñ from the string
ÐHello, World!Ñ ?
24. In the API documentation of the String class, look at the description of
the trim method. What is the result of applying trim to the string Ð
Hello, Space !Ñ ? (Note the spaces in the string.)
P RODUCTIVITY H INT 2.1: Don't MemorizeÐUse Online
Help
The Java library has thousands of classes and methods. It is neither necessary nor
useful trying to memorize them. Instead, you should become familiar with using the
API documentation. Since you will need to use the API documentation all the time,
it is best to download and install it onto your computer, particularly if your
computer is not always connected to the Internet. You can download the
documentation from
http://java.sun.com/javase/downloads/index.html .
2.10 Object References
In Java, a variable whose type is a class does not actually hold an object. It merely
holds the memory location of an object. The object itself is stored elsewhereȌsee
Figure 16 .
We use the technical term object reference to denote the memory location of an object.
When a variable contains the memory location of an object, we say that it refers to an
object. For example, after the statement
Search WWH ::




Custom Search