Java Reference
In-Depth Information
TIP: Assume Your Coworkers Are Malicious
Our discussion of privacy leaks in the previous subsections was concerned with the
effect of somebody trying to defeat the privacy of an instance variable. You might
object that your coworkers are nice people and would not knowingly sabotage your
software. That is probably true, and we do not mean to accuse your coworkers of
malicious intent. However, the same action that can be performed intentionally by a
malicious enemy can also be performed inadvertently by your friends or even by you
yourself. The best way to guard against such honest mistakes is to pretend that you
are defending against a malicious enemy.
Self-Test Exercises
41. Complete the defi nition of the method set for the class Person ( Display 5.19 ).
42. Classify each of the following classes as either mutable or immutable: Date
( Display 4.11 ), Person ( Display 5.19 ) , and String .
43. Normally, it is dangerous to return a reference to a private instance variable of
class type, but it is OK if the class type is String . What is special about the
class String that makes this true?
5.4
Packages and javadoc
... he furnished me,
From mine own library with volumes that
I prize above my dukedom.
WILLIAM SHAKESPEARE, The Tempest
In this section, we cover packages, which are Java libraries, and then cover the javadoc
program, which automatically extracts documentation from packages and classes.
Although these are important topics, they are not used in the rest of this topic. You can
study this section at any time you wish; you need not cover this section before studying
any other topic in this topic.
This section does not use any of the material in Section 5.3, and so can be covered
before Section 5.3 .
This section assumes that you know about directories (which are called folders in
some operating systems), that you know about path names for directories (folders),
and that you know about PATH (environment) variables. These are not Java topics.
They are part of your operating system, and the details depend on your particular
 
 
Search WWH ::




Custom Search