Java Programming ... From the Grounds Up
Part 4
Packaging up your code
Advanced Java Classes
The collection of Java classes is structured as a tree, in which each node has exactly one parent. Since Java classes can only inherit from one class at a time, it is said to support a single-class inheritance hierarchy.
FIGURE 2
Important components of the Java hierarchy.
java.lang
Boolean Character Integer
Long Float Double
String Class Math
Number Object Process
System Thread
java.awt
Button Canvas Checkbox
Choice Color Dimension
Event FileDialog Font
Graphics Image Insets
Label List Menu
MenuBar MenuItem Panel
Point Polygon Rectangle
Scrollbar TextArea TextField
Window
java.io
DataInput DataInputStream InputStream
DataOutput DataOutputStream OutputStream
File FileInputStream FileOutputStream
FilenameFilter FilterInputStream FilterOutputStream
PrintStream RandomAccessFile StreamTokenizer
java.net
ContentHandler InetAddress ServerSocket
URL URLConnection URLStreamHandler
java.applet
Applet AudioClip
java.util
BitSet Date Dictionary
Enumeration Hashtable Properties
Random Stack StringTokenizer
Vector
The top of the Java class hierarchy is organized into a set of related classes, called packages. The main Java packages are java.lang, java.net, java.io, java.awt, java.util, and java.applet. The java.lang package implements the basic components of the Java language, including string manipulation, mathematical functions, and conversion operations such as the simple string-to-integer one seen in Primes.java. The java.net package contains the network access functions, including those associated with opening a URL and getting its contents. The java.io package handles all kinds of input and output, implementing various forms of streaming (much like stdin and stdout in C or cin and cout in C++). Graphics are handled by java.awt. "AWT" is said to stand for "Another Window Toolkit" or "Advanced Window Toolkit," depending on who you ask. The AWT implements standard graphic components such as menus, panels, buttons, and checkboxes. The AWT also implements a number of sophisticated image manipulation functions within the java.awt.image subpackage. If you have ever programmed Windows or Macintosh graphics, used X or a higher level toolkit such as Tk, then AWT will seem very familiar. The java.util package has additional utility functions for string, vector and stack manipulation, hashing, date conversion, and a number of other goodies. Finally, java.applet is a very special package that actually creates a subclass of Applet whenever a new applet is produced.
[ < Java Programming ... From the Grounds Up: Part 3 ] |
[ Java Programming ... From the Grounds Up: Part 5 > ] |
|