What is this "Java"?
- Java is a general purpose programming language. This is a strength and a requirement for success, but
it's not sufficient by itself.
- It is an object-oriented language. OOLs are very popular, perhaps unjustifiablly so. Java is more
or less based on C++, but there are some differences. For instance, pointers are implicit so pointers and
addresses need never bother programmers. But some of the advantages of pointers are lost then, for instance,
you can't travel down an array by incrementing a pointer.
- It is platform independent. It's like TeX that way: it runs exactly the same on every machine.
- It is extremely portable. Java programs are compiled once, not once for each platform. But not
all platforms support Java yet.
- It is network friendly. Browsers on the web can run Java applets.
- It has a GUI, the AWT (Abstract Windows Toolkit), part of the JDK (Java Developers Kit).
- Speed? Not as fast as a real compiled program. But look at Paul Callahan's
Conway's Life Game, in particular,
the Life Pattern Catalog.
How does it work?
- Like any other programming language, you write the source program. Your program will include
calls to the methods in the JDK.
- Compile your program into (either standalone applications or) applets that can run in conjunction
with a web browser (Netscape)
- Debugging. Of course it's tough. The language is like C++, a little smoothed, but still
prone to syntax and semantics errors. There's an appletviewer that helps to find errors, but the
debugger is not helpful. It's easy to misinterpret the JDK stuff and get no output at all.
- The working applet is invoked by the APPLET tag in an HTML file when Netscape reads it
Nuts and Bolts -- The Java Language
An aside on JavaScript
JavaScript is not Java.
JavaScript is a language that looks like Java that Netscape created for better communication with its browser.
JavaScript appears in an html file and is interpreted by the browser. It has some built-in objects, but no more
can be created by the programmer. It has loose typing and dynamic binding. It doesn't do a lot that Java does, for
instance, draw a circle.
More on support packages for Java
Sun has included a few support packages for the Java language. One, java.lang, is automatically accessible to
any program you write. It includes the important classes of String and Math, and a number of others. With the String
class, you can treat strings as units, creating them, accessing individual characters, concatinating them, copying them,
finding characters and substrings in them, etc. The Math class consists of "public static" methods, i.e., useful functions
such as trig, exponential, log, inverse trig, sqrt, ceil, floor, random, abs, max, and min. The Thread class is included in java.lang.
Two more pacckages, java.io and java.util, make up the core packages. In order to use Java with the web, the most
important packages are java.awt and java.applet. The java.applet package really isn't very big, since it relies
so much on the java.awt package.
References
- The best reference is Sun's Java Tutorial. But it doesn't include
everything you need to know. The more arcane information involves the AWT and JDK. For documentation on that, use
Java API Documentation. Documentation has been very lean
for the last year, but now there are many introductory texts. Most, however, don't answer the questions you'll
have when you get into advanced problems.
- Nelson Yu's New AWT Tutorial explains the Abstract Windows Toolkit in the JDK (Java Developers Kit
- The Java FAQ and Brewing Java, a tutorial
- T. J. Willis' Java for Human Beans, an outline of a talk given at the KCACM March, 1996, Meeting
- JavaSoft, Sun's official Java site
Java Indices
David E. Joyce
Email: djoyce@clarku.edu