There is an alphabetical index. This page is a sample piece of documentation generated from java.mth . For more information see the documentation on Dr. Botting's MATHS project.



    Please contact me at [ ] if you have any comments, suggestions, corrections etc.

    Elsewhere on the Web

    FAQ: Try one of the following: [ faq ] [ javafaq.html ] [ javafaq ] [ java.FAQ.html ]

    [ ~espresso ] [ ] [ phoneCase.html ] [ wallstreetweb ] [ index.html ] [ ] [ ] [ ] [ ] [ algintro.html ]

    See Also: New and unsorted Java Announcements [ java.www.sites.html ]

    My samples: [ ]

    Java at CSCI.CSUSB.EDU(October 1996)

    We have the Java Development Kit (1.0) with its compiler, interpreters, library packages, documenter, and disassembler on the Sun Workstations in JB358 and Orion. The binaries, libraries etc are in /usr/local/java. The compiler and interpreter (javac & java) figure out where the classes are relative to this directory. I have programmed 'Q'/'quickie' to compile, document, and interpret Java applications for users of the Sun systems here. All the Java tools can be run by typing in their name and the right arguments, as long as you are on a Sun and have /usr/local/bin in your PATH

    Further the

    directory on Orion is on the World Wide Web where it appears as
    See my 'how-to' guide: //www/dick/publishing

    This page plus the [ CS320 Labs ] are designed to be a step by step introduction to Java for a competent programmer.

    The Java Programming Language


    Java can be used to write applications and applets. A Java application is similar to any other high-level language program in that it is compiled and then run on the same machine. An applet is compiled on one machine, stored on a server in binary, and is then sent to a another machine over the Internet to be interpretted by a Java-aware browser.

    An application may compile and run like any other program but it is actually a class [ class ] that contains a special method called 'main'. When the interpreter [ java ] is called with the name of the class, Java looks for main(String[]) in the class and invokes it:

    The HelloWorld Application

     	import java.lang.*;
     	class Hello {
     	    public static void main(String argv[]){
     	        System.out.println("Hello, World!");
    If the above is in a file called [ ] then it would be compiled like this:
    and run by the java interpreter like this:
     		 java Hello
    Notice that the file is compiled, but a class in interpreted. Compiling a Java file can generate one or more classes. The import statements allow a class to refer to other classes in other files. The compiler use these other classes's definitions to check your code, and the interpreter loads the classes binary as part of the running program.

    Notice that Java code was designed to be interpreted by a machine independent virtual machine that runs bytecode [ bytecode ]

    Automatic Documentation Tools

    One nice feature of the Sun JDK are the documentation tools. A program javadoc generates HTML documentation files from Java source code [ javadoc] . One HTML file per class. Classes and parts of classes can have special documentary comments added to them that are reformatted and incorporated into the Hypertext produced by javadoc. This could be a boon for large scale projects [ Doc_Comment in java.syntax ]

    Another Simple Application

    For an example of a simple and useless Java application and its documentation see [ ] and [ Luv.html ]

    The Disassembler

    The javap program disassembles bytecode (*.class files) and outputs a description of the what is in them [ javap] .

    A Simple Applet

    An Applet [ applet ] is a small program that can be sent across the Internet and interpreted on a client machine. Typically an applet consists of a collection of classes in a file, and the file is referred to in a Web Page [ www.html ] written in the HyperText Markup Language(HTML) [ comp.html.syntax.html] .

    Notice that you can not run a Java applet unless you have a WWW page that refers to it. The page needs HTML like the following to call the compiled code, in the same directory:

              <APPLET CODE="ClassName.class" HEIGHT=h WIDTH=w>
    		Altenate text
    where h and w are the HEIGHT and WIDTH of the box in which the applet outputs its response. The alternate text between
    is displayed when a browser can not handle APPLETs. For the general syntax see [ applet_in_html] . The code is the result of compiling a file called ClassName.class that contains a public class called ClassName which extends an Applet.

    Hello World Applet

    Here is a suitable piece of HTML to test the HelloWorld class:
              <APPLET CODE="HelloWorld.class" HEIGHT=150 WIDTH=150>
     		You can not see this brilliant Java Applet.
    Put this in a file called:

    The code for the HelloWorld applet has to be a public class called HelloWorld that extends Applet and is in in a Java file called:
    Here is the Java code taken from this file:
     	import java.applet.*;
     	import java.awt.*;
    	public class HelloWorld extends Applet {
    	      public void init() {
    	      public void paint(Graphics g) {
    	          g.drawString("Hello world!", 50, 25);

    The Applet is compiled just like anyother program:

    This will generate a set of files with extension/suffix ".class". Notice that the compiler forces you to name the file
    and the Class
    and generates the binary bytecode in a file called

    However you can not use 'java' to run the class - it has no 'main'. Niether can 'java' "run" the test.HelloWorld.html file.

    Sun has written a special program to test applets in page that is part of there Java Developer's Kit. [ JDK ] Here is how you use it to test the HelloWorld applet:

     		appletviewer test.HelloWorld.html
    Notice that you point it at the test page that points to the class!

    On the Suns in the Sun lab you can point 'Netscape' directly at a test page:

     		netscape test.HelloWorld.html
    but this does not work with Orion.

    Publishing a Page and Applet

    The simplest thing to do is to use
     		publish *HelloWorld*
    and all the files (the test page, the class, the code, and any documentation) are all made public. [ publishing] .

    Netscape on any machine can now be pointed at your test page:

     		netscape /public/group/your_id/test.HelloWorld.html

    Applications that Run Applets

    The 'java' interpreter can run classes that have an appropriate 'main' function:
    	java classname
    This special method [ method ] is called main must create a new window(a Frame) in which the applet can display its output:
         public static void main(String args[]) {
     		Frame myWindow = new Frame("HelloWorld");
     			//A window that can hold a "HeloWorld" object
     		HelloWorld helloWorldObject = new HelloWorld();
     			//The object that will be put in the window
     			//HelloWorld has now initialized it self
     			//HelloWorld has now started running
     		myWindow.add("Center", helloWorldObject);
     			//myWindow now has HelloWorld in it's center
     		myWindow.resize(300, 300);;
    You can download an uptodate working copy of the HelloWorld class which is both an applications and and applet from [ ]

    Applets, Classes, and Bytecode

    Each ".class" file encodes [ bytecode ] a single "class" from the file. These classes can be executed by the "java" program or transmitted via the world wide web to a browser that runs them. It is said that if the page is in directory with path name D on the server and your operating system uses S in path names
    	( S.DOS=`\`, S.UNIX=`/`, S.Mac=`:`)
    then the applet code for class C must be in directory DSclasses and have a name C.class. However Netscape 2.01 for Suns looks in directory D, unless you add the attribute CODEBASE=classes to the Applet tag.


    Javascript is a mark up language invented by Netscape to satisfy the same need as Sun's Java. Namely to have a way of sending code accross the WWW and have it run on the client's system. (Unlike a CGI [ CGI in comp.html.syntax ] which is executed on the server and sends the results to the client). It was originally called "livescript". It looks like Java. Javascript is probably easier to implement in a browser.



    [ ] or equivalently [ ] or the (partial mirror) [ ]

    More General Information

    For more general information see the Java and HotJava Documentation [ documentation.html ] and in particular the goals of Java [ index.html ] and the Java Tutorial at [ ] or download // and unzip it into a HTML page.

    Programmers need Sun's documentation [ Documentation ] and may find a programmer's guide [ index.html ] helpful.

    For details see below and [ See Also ]


    Also see [ java.glossary.html ]

  1. abstract::method=`A method that must exist for objects in a class but is fully defined only in subclasses`,
  2. abstract::class=A class with one or more abstract methods.
  3. applet::=A small program that can be sent across a network and interpreted safely on the receiving machine.
  4. application::Java=A class that defines a public static void main(String args[]) method

  5. AWT::=awt.
  6. awt::=Abstract windowing toolkit, another windowing toolkit. A set of machine independent classes that make it easier to create graphic user interfaces and output.
  7. bytecode::= [ byte_code] .
  8. byte_code::=a way of describing classes as a stream of byte oriented machine code for the Java Virtual Machine.
  9. field::java=A variable associated with a class - a piece of data or knowledge that that object knows about and controls.
  10. file::=A collection of data. A Java source code file defines one or more classes, interfaces that is placed in a particular package.
  11. class::=A set of objects with similar behaviors and intelligence. A class defines a collection of knowledge and know how. Classes are defined by declaring variables and and functions..
  12. function::computing=A named piece of code that returns a value and may also do something
  13. function::java=A piece of know-how attached to a class or accessed via an object
  14. interface::=The way that something is accessed from outside. The parts of an obnject that are shared with the clients that use that object.
  15. interface::java=A collection of function headers that can be implemented in different ways by different classes, and extended to give more interfaces..
  16. JDK::=Java Development Kit: the compiler: javac, interpreter: java, and the classes.
  17. method::=A piece of "know-how". A procedure or function that is associated with an object or a class.
  18. interface::=Describes a set of classes in terms of what they can do for you, but allows each class to implement these methods in any way that you wish.
  19. object::=An instance of a class.
  20. procedure::ComputerScience=`A named piece of code that does something for a caller'.
  21. procedure::java=a void function.
  22. static::=something associated with a class rather than an object.
  23. variable::java=A piece of knowledge associated with a class or an object.
  24. virtual_machine::=A hypothetical machine that can be emulated on many different actual machines.
  25. void::=word used in place of a type to indicate that a function does not return a value. -- introduced in ANSI C and still confusing people 10 years later.

    Also see [ java.glossary.html ]



  26. CLASSPATH::UNIX_variable=Tells java tools where to to look for classes.
  27. CLASSPATH::UNIX_path=value of CLASSPATH.
  28. UNIX_path::=directory #(":" directory).
  29. appletviewer::command=Scan HTML file for Applt tag and display its appearance.
  30. binary::=A file that can be loaded and run as a program which uses the machine's own language.
  31. java::command=run compiled class name (_). -- not the name of a class file!
  32. javac::command=compile Java source code file named (_) generating one or more *.class files.
  33. javadoc::command=Extract HTML documentation from Java Source code file named (_).
  34. javap::command=Disassemble a bytecode class (_).

    File names

  35. name_of_class_file::= class_name ".class". -- watch out for case sensitivity.
  36. name_of_java_file::= identifier ".java".


  37. applet_in_html::tag= applet_tag #(applet_parameter_tag) O(alternative_html_text) "</APPLET>".
  38. applet_tag::= "<APPLET" applet_tag_attributes ".
  39. applet_tag_attributes::=O(alignment) O(codebase) code width height O(alternative) O(name) O(vertical_spacing) O(horizontal_spacing).
  40. code::="CODE=" quoted(name_of_class_file), -- relative to [ code_URL ] & [ codebase] .
  41. quoted(X)::= double_quote X double_quote.
  42. width::="WIDTH="number.
  43. height::="HEIGHT="number.
  44. applet_parameter_tag::="<PARAM" "NAME=" quoted(name) "VALUE="quoted(value) ".
  45. alignment::= "ALIGN=" ( "LEFT" | "MIDDLE" | "RIGHT" ).
  46. codebase::= "CODEBASE=" quoted(code_URL).
  47. code_URL::=the directory that contains the applet's code.
  48. alternative::= "ALT=" quoted(text).
  49. name::="NAME=" applet_instance_name.
  50. vertical_spacing::="VSPACE=" pixels.
  51. horizonal_spacing::="HSPACE=" pixels.

  52. app_in_html::tag="<APP CLASS="name_of_class ", --obsolete

  53. future_HTML::="<embed" arguments ">"" alternative "</embed>".


    Netscape developed a similar language to Java that is written inside HTML documents. It is not Java, but has some simlar syntax and ideas.


    Specification of Java

    There is a short glossary of the terms used in Java: [ java.glossary.html ]

    "The Java Language Specification" Version 1.0 beta is at JavaSoft in compressed Postscript // and zipped postscript // Sun holds older versions (I guess). and there is a WWW version of the 1.0alpha documents [ javaspec_1.html ]

    Syntax of Java

    A short summary(1.0alpha) can be found at [ HEADING75 in javaspec_11 ] , . . . and locally [ java.syntax.html ]

    "The Java Language Specification" [ Specification ] has a complete and up to date grammar.

    For a Lex/Yacc version of the syntax see guavac [ guavac] .

    For a Java compiler-compiler see the Constructor of Useful Parsers, put out by Scott Hudson of Georgia Tech [ home.html ]


    Java has its meaning defined by a compiler into a bytecoded virtual machine, plus a specification of the virtual machine. These were once held at or I'm looking for up-to-date URLs...

    My own notes are under construction [ java.semantics.html ]

    File Formats

    A specification of the format of a .class file was held at

    Also see [ Trivia ]

    Pre_Defined Classes

    Java by itself is a smallish language. The predefined classes give it a lot more power. These are grouped into packages in the Java run-time library: [ packages.html] .
    For more see [ java.classes.html ] [ java.class.tree.html ] and [ 1.0.2 ]


    ISO is now involved in co-ordinating the development of a standard version of Java, see [ ]


    Team Java has a page of pointers to Collections of Applets [ #applets] . Also see Earthweb's Java Directory [ ] More T B A

    See Also

    The Source Code

    Start searching here: [ ]


    [ ]


    The Java announcements archive [ ]

    Local archives of announcements: [ java.www.sites.html ] (after July 29th 1996) [ ] (before July 29th 1996)

    FAQs, Bugs, Features, and Directories

    The Java Newbie FAQs from Usenet //

    Elliotte Rusty Harold's Official Frequently Asked Questions [ javafaq.html] .

    Also see TeamJAVA [ ] and HowDoI at Digital Focus: [ howdoi.html ] Also see Earthweb's Java Directory on [ ]

    Bugs and requested features page: [ bugsandfeatures.html ] at

    I culled a few common questions and answers in [ java.FAQ ] but these are very rough and ready as yet, and not official FAQs for Java. Also see the uneditted version: [ java.mbox ]

    Other Tutorials

    At Fairfield: [ java.html ]

    Or download, unzip, and browse thru Sun's tutorial: //

    Marty Hall's Tutorials [ #Tutorials ]

    (CS320 Labs): These take you step-by-step through a series of Java Applets and Programs from your first Applet to using the AWT to do graphics and layouts: [ lab1.html ] [ lab2.html ] [ lab3.html ]


    Errata for "Java in 21 Days" [ errata.html ]

    Examples etc for "Java in a Nutshell" //

    Local links

    [ CS320 Labs ]

    Newly mentioned Java sites on the WWW [ java.www.sites.html ] , . . . information on objects in general [ objects.html ] , . . . information on language including Java [ Java in languages ] , . . . and notes and links about software engineering in general [ se.www.sites.html ]

    Finally, the pick of the Usenet news: //www/dick/samples/java.mbox



    On UNIX a compiled class can be recognized because it will contain the magic string of bytes that spell out in hexadecimal 0xCAFEBABE.

    The Naming of Java

    Some think it means "Just Another Vague Acronym".

    The name "Java" is not an acronym. The original name was "Oak", after the tree outside the developers window, but it turned out that "Oak" was already copyrighted/trademarked/in-use. The descriptions of the next stage vary but all indicate some kind of brainstorming session and/or a local coffee shop, during which name "Java" was proposed and accepted.

Labels and Definitions in Alphabetical Order