Tom Kelliher, CS 116
Sept. 8, 2000
The recurring concept of conceptual and formal models.
Read Sections 2.1--2. Look through 2.8. This is the interface documentation for the Java-provided classes we're using.
Lab 1.
More on applets. Methods.
Observations:
By now, you should be able to create a new Java project in JWS and add a
file to it. Practice with Add.java
, if necessary.
"Colors.java"
)
colors
or Colours
?
.java
file!
Recall our first example:
import java.applet.*; import java.awt.*; // The Hello class simply displays the string "Hello, world!" // within the graphics object. public class Hello extends Applet { public void paint(Graphics g) { g.drawString("Hello, world!", 20, 10); } }Let's look at the applet in more detail:
import
statement: import java.applet.*;
;
ends a statement. Required.
Missing semicolons and compiler diagnostics.
java.applet
and java.awt
are packages ---
collections of classes. For example: java.applet.Applet
and
java.applet.AppletStub
.
*
is a wildcard --- match anything.
java.awt
?
class
declaration:
public class Hello extends Applet { // ... }Meaning of each of the keywords/identifiers? Identifier-forming rules? Uniqueness. Conventions.