Java programs that do not run on a browser (i.e., not Applets) need a main method to get them started. The main method
The book focuses on these (applications), but I will continue to show both.
Applets and JApplets need .html pages with applet tags to be shown on browsers
Here is a Class template:
imports ...
public class ClassName extends super {
// Declare and possibly set values for variables
Instance and Class Variable declarations
private int instanceVariable;
public static int classVariable;
// Define Constructors (if none - looks at supers. No return type)
public ClassName (formal parameters) {
code
}
// Define methods with no returned values
public void methodName (formal parameters) {
code
}
// Define methods with return values
public returnType methodName (formal parameters) {
code
return ... // returnType of value returned must match method signature
}
}
OK, we have Classes and their Instance/Class variables and methods
Note then, when we look at packages (e.g. java.lang), we see other Summaries: Interface, Class, Exception, and Error