Origins of Java (sidebar 2.1) 1)
Java is a successor to Scheme and SmallTalk (among other languages).
Java is only superficially (syntactically) similar to C and C++. Semantically, Java is very different from these and other languages.
Packages 2)
Java source files
may be organized into
packages. Every source file in package
p must begin with the declaration
package p;
and must be stored in a subdirectory called p.
A class declared in a source file with no package declaration belongs to the anonymous default package.
Our BlueJ projects last year in 102 were all default package projects, but the projects we create in Netbeans this semester will all have explicit package declarations.
Class
C within package
p may be imported explicitly using
import p.C;
or all classes within package p may be imported using wildcard notation:
import p.*;
Let’s take a look at named and default packages in Netbeans.
Objects and Variables 3)
Stack and Heap diagrams figure 2.2 (p. 19)
Exercises 2.1, 2.2, 2.3, 2.4