Java Programming from the Grounds Up
Packaging up your code
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
Advanced Java Classes
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.
NEXT
Mark Reynolds is a network protocol designer, Java programmer, computer animator, and fanatic mountaineer. He currently consults to Adaptive Optics Associates, a United Technologies company.
Reprinted from Web Developer® magazine, Vol. 2 No.1 Spring 1996 (c) 1996 internet.com Corporation. All rights reserved.
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|