Java Reference
In-Depth Information
attempt to locate the com.horstmann.bigjava package in
/home/walters/lib/com/horstmann/bigjava/com/horstmann/bigjava
and won't find the files.
S ELF C HECK
18. Which of the following are packages?
a. java
b. java.lang
c. java.util
d. java.lang.Math
19. Is a Java program without import statements limited to using the
default and java.lang packages?
20. Suppose your homework assignments are located in the directory
/home/me/cs101 ( c:\me\cs101 on Windows). Your instructor
tells you to place your homework into packages. In which directory do
you place the class hw1.problem1.TicTacToeTester?
367
368
C OMMON E RROR 8.3: Confusing Dots
In Java, the dot symbol ( . ) is used as a separator in the following situations:
ȗ
Between package names ( java.util )
ȗ
Between package and class names ( homework1.Bank )
ȗ
Between class and inner class names ( Ellipse2D.Double )
ȗ
Between class and instance variable names ( Math.PI )
ȗ
Between objects and methods ( account.getBalance() )
When you see a long chain of dot-separated names, it can be a challenge to find
out which part is the package name, which part is the class name, which part is
an instance variable name, and which part is a method name. Consider
Search WWH ::




Custom Search