Classes and Objects:
•The class is
the unit of programming
•A Java program is a collection
of classes
•Each class definition (usually)
in its own .java file
•The file name
must match the class name
•A class describes objects
(instances)
•Describes their common
characteristics: is a blueprint
•Thus all the instances have these
same characteristics
•These characteristics are:
•Data
fields
for each object
•Methods
(operations) that do work on the objects
Grouping Classes: The Java API,
•API = Application Programming
Interface
•Java = small core +
extensive collection of packages
•A package consists of some related Java classes:
•Swing: a GUI (graphical user
interface) package
•AWT: Application Window Toolkit
(more GUI)
•util:
utility data structures (important to CS 187!)
•The import statement tells the compiler to make
available classes and methods of another package
•A main method indicates where to begin executing a
class (if it is designed to be run as a program)
No comments:
Post a Comment