Java and Database Connectivity
|
A bit about syntax: declaring a class
public final class BlobHand extends Hand
{
int radius; // the radius of my blob
-
public means that any other class in any other
package may use this class
-
it might be
protected (only usable by
other classes in the same package)
-
or
private (only usable by other classes
in the same file)
-
final means that no class may specialise
('extend') this class
-
most classes are not final
-
class means it's a class
-
BlobHand is the name of this class
-
extends Hand means that a BlobHand is a kind
of Hand, and inherits all Hand's behaviours and properties
-
radius is an instance variable of
BlobHand. Every instance (object) in the BlobHand class has
a radius. It doesn't have to be the same radius.
-
A public class must be declared in a file whose name is the
same as the name of the file (with the extension '.java'.
So the class
BlobHand must be declared in a
file called BlobHand.java