[Skip Navigation] [CSUSB] / [CNS] / [CSE] / [R J Botting] /[CS320 Course Materials] /java.html [java.txt(Text)] [Search ]
Thu Aug 25 20:59:54 PDT 2011
[Schedule] [Syllabi] [Text] [Labs] [Projects] [Resources] [Grading] [Contact]
Notes: [01] [02] [03] [04] [05] [06] [07] [08] [09] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]
Opening the PDF files on this page may require you to download Adobe Reader or an equivalent viewer (GhostScript).

Opening Microsoft files (winzip, word, excel, powerpoint) on this page may require you to download a special viewer. Or you can download and save the files and use your preferred office applications to view and edit them.

Contents


    The Java Programming Language

       http://cse.csusb.edu/dick/samples/java.html

      This page plus the [ CS320 Labs ] are designed to be a step by step introduction to Java for a competent C++ programmer. Getting your first Java programs to run is unusually hard because
      Net

      1. Names of files have to precisely match the identifiers used inside the files.
      2. Names of classes in Applets must match the names of classes in Java.
      3. It is hard to keep all these names in synchronization as the code develops.
      4. Some books do not follow the newer scoping rules.

      (End of Net)

      Beginners should work through the [ Overview ] and [ Java at CSCI.CSUSB.EDU ] sections below to make this process less painful.

      Comments?

      Please send mail to me at dick@csci.csusb.edu if you have any comments, suggestions, corrections etc.

      Java at CSCI.CSUSB.EDU

        If you are not interested in our local set-up please see the Overview section below.

        Publishing Java

        Your /public directory is an ideal site on the World Wide Web for Java files and Web Pages. Make sure you publish all the compiled classes needed on your published pages! See [ publishing ] for some notes.

        Quick Compilation

        Q/quickie [ quickie ] on our workstations and servers has been told where the JDK is stored on that machine. It compiles your program and invites your to execute it.
         		quickie MyFirstProgram.java

        Latest News in PDF

        Also see [ java.pdf ] for more on the state of Java at CSUSB.

      . . . . . . . . . ( end of section Java at CSCI.CSUSB.EDU) <<Contents | End>>

      Overview

        Java is designed to be a completely object-oriented programming language used in consumer appliances like VCRs and toasters. It is based on the first version of C++ but explicitly leaves out features of C and C++ that are confusing or unreliable.

        It has inheritance and dynamic polymorphism but not generics and/or templates. It is designed with concurrent programming in mind. It has most of the expressions and control structures of C plus exceptions but without the "go to". So a C++ programer finds Java programs easy to read but verbose. It is slightly more work to write, but the result is nearly always clearer than the abbreviated C++ code.

        Java is compiled into a special machine code that is then interpreted. Java code does not perform as fast as C++. The interpreter however protects the machine on which it is running from errors that can break operating systems in C++. Furhter the same (compiled) code can run on many different systems: Compile-Once-Run-Anywhere. So a Java program can be transmitted across a network to a machine of a different type, with a different operating system, and different graphic user interface. There it will run safely and securely (in theory) and look-and-feel as if it was programmed for that system. Doing this with C++ is extremely expensive.

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

        Java comes with a large library of ready made classes and objects. The key difference betwen Java 1.0 and 1.1 was in this library. - the AWT. Similarly, Java 2.0 has a very much larger library for handling user interfaces (Swing by name) but only small changes to the core of the language.

        Applications

          An application is compiled (using javac) and run like any other program but it is actually a Java class that contains a special method called 'main'. When the interpreter (java) is called with the name of the class, it looks for the public static main(String[]) function in the class and calls it.

          Example Application

          The following is based on the old traditional C program that prints "Hello, World" on the computer screen:
          (Hello):
             	import java.lang.*;
             	public class Hello {
             	    public static void main(String argv[]){
             	        System.out.println("Hello, World!");
             	    }
             	}

          The above is best put in a file called Hello.java [ java/Hello.java ] and then compiled with 'javac Hello.java' and then run: 'java Hello'.

          The import statement in a Java file allow it to refer to other classes in other files and directories. The compiler uses these other classes's definitions to check your code, and the interpreter loads the binary bytecode into the running program.

          The word public means that the thing following it can be accessed by anyone. A public class can be imported over the internet into any other class and so can be sent to a browser. A public function can be called by statements and expressions in different classes.

          static indicates that a function or object belongs to the class rather than to each individual object in the class. The function is called like this 'Hello.main(...)' even when there are no objects constructed in class Hello.

          For an example of a simple and useless Java application and its documentation see the first CS320 Lava lab [ Java in index ]

          Notice that Java code was designed to be interpreted by a machine independent virtual machine (JVM) that runs a special machine code called bytecode.

        . . . . . . . . . ( end of section Applications) <<Contents | End>>

        Tools

        The Hello application would be compiled like this:
         		 javac Hello.java
        and run by the java interpreter like this:
         		 java Hello
        Notice that the file "Hello.java" is compiled, but a class is interpreted.

        One nice feature of the Sun JDK is the documentation tool javadoc. The above application Hello has the following documentation: [ java/Hello.html ] which was generated by javadoc. javadoc scans source code files (*.java) and creates one HTML file per class in the files. Classes and parts of classes can have special documentary comments (starting "/**" ) added to them that are reformatted and incorporated into the Hypertext produced by javadoc. This should be a boon for realistic projects. The full syntax of the special comments can be found at [ Doc_Comment in java.syntax ] on this web site.

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

        Applets

          An Applet is a small program that can be sent across the Internet and interpreted on a client machine. To give permission for remote access it must be a public class. Typically it is a class that inherits and/or defines a special set of functions needed to run an applet. These are part of the class Applet. So all Java applets are public classes that extend Applet.

          You can not run a Java applet unless it is also an application or 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>
          		Alternate text
          		</APPLET>
          where h and w are the HEIGHT and WIDTH of the box in which the applet outputs its response. The alternate text appears when a browser can not handle APPLETs. For the general syntax see applet_in_html. The code in "ClassName.class" above, is the result of compiling a file called "ClassName.java" that contains a public class called ClassName which extends an Applet. (For details on HTML see [ www.html ] written in the HyperText Markup Language(HTML) [ comp.html.syntax.html] . )

          Example

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

          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:

           		HelloWorld.java
          Here is the Java code:
          (HelloWorld):
             	import java.applet.*;
             	import java.awt.*;
            	public class HelloWorld extends Applet {
            	      public void init() {
            	          resize(150,25);
            	      }//init
            	      public void paint(Graphics g) {
            	          g.drawString("Hello world!", 50, 25);
            	      }//paint
            	  }//HelloWorld

          The Applet is compiled just like any other program:

           		 javac HelloWorld.java
          This will generate a set of files with extension/suffix ".class". Notice that the compiler forces you to name the file "HelloWorld.java", the Class "HelloWorld", and generates the binary bytecode in a file called "HelloWorld.class". javadoc scans the "HelloWorld.java" and creates "HelloWorld.html". Sun has written a special program to test applets in page:
                    appletviewer test.HelloWorld.html
          However you can not use 'java' to run the HelloWorld class - it has no 'main'. Neither can 'java' "run" the WWW pages like the test.HelloWorld.html file.

          On the Suns in the Sun lab you can tell 'Netscape' to "Open local File..." and select

           		test.HelloWorld.html
          but using the older Netscape to debug an applet has some problems indicated later.

          Public Classes and Pages

          The moment a .class file or a package becomes public on the web, other Java classes, anywhere on the web, can "import" your public classes and use them to construct more classes!

          Normally you should put applet code (compiled and source) in the same directory as the public page that refers to them. This is simple and works.

          For example, here at csci.csusb.edu you develop the code, documentation, and test page for HelloWorld in your home directory. If you set the shell variable PUB to your public directory then you can then just input this command

           		cp *HelloWorld*  $PUB
          and all the files (the test page, the class, the code, and any documentation) are all made public. Netscape on any machine can now be pointed at your test page:
           		netscape http:/public/group/your_id/test.HelloWorld.html
          For more information on publish see [ publishing ]

          There are more complicated ways of organizing the files. It is said that if the page is in directory with path name D on the server and your operating system uses S to separate directories 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.

          Debugging Problems with Browsers


          (problems):
          • To be sure of a browser finding all the necessary class files they have to be in the same directory as the pages that refer to them. You can not keep the bytecode .class file private and the page public. To put .class files in a subdirectory you may have to place them in a package with the same name as well.

          • If the Applet fails, use the Options menu to open the Java Console... and look for errors.

          • The Older Netscape running in background does not make a good development tool because it is hard to make the program reload the code of Applets. You can change the code, recompile it, publish all the files perfectly, and hit the reload button in Netscape and it will not reload the new bytecode. I've wasted hours looking for bugs that I've fixed. Instead use Sun's appletviewer and/or debuggers. You can also include a main function in applets that make them applications. See [ Applications Can Run Applets ] next.

          • If it is absolutely necessary to debug the applet inside an html page then (1) use the Sun Appletviewer, (2) find a machine with Netscape 4.0 and use Shift+Reload, or (3) execute Netscape directly on a local copy of the page and Exit from it before working on the applet code. In vi you can use something like this:
             		:!java %
             		:!netscape test.page.name.html
            to suspend the editor and run Netscape on the test page. Exit Netacape and tap Return/Enter to continue editting. On Orion, if you use Q to compile a program Stuff.java and you have a readable file called test.Stuff.java then it will automagically execute netscape for you. This is in Beta -- EMail dick if you don't like it.

          Applications Can Run Applets

          The 'java' interpreter can run classes that have an appropriate 'main' function:
          	java classname
          This special method or function is called main. To run an applet it must create a window and run the applet in it. The steps are:
          1. Create a new window to display the applet.
          2. Create a new object of the correct class.
          3. Tell the applet to initialize itself.
          4. Tell the applet to start running.
          5. Add the running applet into the window.
          6. Resize the window.
          7. Show the window to you.

          Please use the following sample as a model for your own testing:
          (applet_test_harness):
           	   private final static int SIZE = 300;//size of window
               public static void main(String args[]) {
           		HelloWorld aHelloWorldObject = new HelloWorld();
           			//The aHelloWorld object exists
           		   aHelloWorldObject.init();
           			//aHelloWorld has now initialized it self
           		   aHelloWorldObject.start();
           			//aHelloWorld has now started running
          
          
           		Frame aWindow = new Frame("HelloWorld");
           			//A window called "HelloWorld" will hold the Applet
           		   aWindow.add("Center", aHelloWorldObject);
           			//aWindow now has aHelloWorld in it's center
           		   aWindow.resize(SIZE, SIZE);
           		   aWindow.show();
           			//aWindow is now shown to you (until you CTRL/C)
               }//main
          You can download an uptodate working copy of the HelloWorld class which is both an applications and and applet from [ java/HelloWorld.java ] Keep a copy of this and use it generate your own test programs for applets.... before you put them on the Web!

          I have just developed a new tool that will generate an HTML test page for a new applet and also a suitable *.java file ready for the details to be filled in It is in [ java/instantapplet ] Please download and try out -- Beta Testing.

          Another Example

          There is a more elaborate example of a Java applet/application program in [ java/test.Goodbye.html ] complete with links to the source code, documentation, and byte code. It also shows how to control fonts and colors of text.

          Caveat

          Here is a warning: The above main programs do not create a complete environment created by a browser looking at an HTML page. The Applet can not access the parameters that can be encoded in the page. Neither can they find out about the width and height encoded in the <Applet> tag.

        . . . . . . . . . ( end of section Applets) <<Contents | End>>

        Summary


        Table
        Application:public class C { ... public static void main(String[])...}
        Applet:public class C extends Applet { ... }

        (Close Table)


        Table
        A class with nameC
        is best put in a fileC.java
        and compiled byjavac C.java
        producing BytecodeC.class
        and documented byjavadoc C.java
        producing C.html

        (Close Table)

      . . . . . . . . . ( end of section Overview) <<Contents | End>>

      Glossary

        Also see [ java.glossary.html ] [ gloss.htm ]

      1. abstract::methods=A method that must exist for objects in a class but is fully defined only in subclasses, -- an abstract method can not be private, final, native, or synchronized.
      2. abstract::classes=A class with one or more abstract methods.

      3. Applet::AWT=Class of objects that are embedded in an HTML page and initialized and run by a browser over the WWW
      4. applet::=A small program that can be sent across a network and interpreted safely on the receiving machine.

      5. application::Java=A class that defines a public static void main(String args[]) method

      6. AWT::=awt.
      7. awt::=Abstract windowing toolkit, another windowing toolkit. A set of machine independent classes that make it easier to create graphic user interfaces and output.

      8. bytecode::= [ byte_code] .
      9. byte_code::=a way of describing classes as a stream of byte oriented machine code for the Java Virtual Machine.

      10. classes::=plural of class.
      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.. [ class in objects.glossary ]

      12. constant::=any final field -- a piece of data about an object or class that can not be varied once it is initialized.

      13. concurrency::=faking multiple processors so that the programmer can pretend that many processes or threads are executing at one time and interacting together. [ Synchronized_statement in java.syntax ]
      14. extends::=indicates that a new class has all the properties of the class it extends. In Java all classes ultimately extend the class Object.

      15. exception::=a way of exitting gracefully from expressions and statements when something unusual occurs, [ Try_block in java.syntax ] [ Throw_statement in java.syntax ]
      16. exceptions::=plural of exception.
      17. field::java=A variable or constant associated with a class or object - a piece of data or knowledge that that object knows about and controls.

      18. file::=A collection of data. A Java source code file defines one or more classes, interfaces that is placed in a particular package.

      19. final::modifier=a final class can not be extended, a final variable can not have its value changed, and a final function can not be overridden.

      20. function::computing=A named piece of code that returns a value and may also do something
      21. function::java=A piece of know-how attached to a class or accessed via an object

      22. ISO::="International Standards Organization".

      23. implements::=indicates that a class defines all the public functions listed in an interface.

      24. interface::=The way that something is accessed from outside. The parts of an object that are shared with the clients that use that object.
      25. interface::java=A collection of abstract public function headers that can be implemented in different ways by different classes, and extended to give more interfaces..
      26. 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.

      27. Java::=A language developed by Sun for developing software that is distributed over the Internet to special purpose hardware like a thermostat or (latterly) to browsers via the WWW.

      28. JDK::=Java Development Kit( compiler=> javac, interpreter=> java, classes=> AWT.

      29. JVM::=Java Virtual Machine, the virtual_machine provides the operational semantics of Java and so defines the hardware+software environment needed to run Java bytecode.

      30. methods::=plural of method.
      31. method::=A piece of "know-how". A procedure or function that is associated with an object or a class.

      32. modifier::=public | static | final | private | protected | abstract | ..., a word placed in front of a declaration that changes its semantics.

      33. object::=An instance of a class, in Java an object is always handled via a reference that is created by the 'new' operation and a constructor and can be assigned to field of that class.

      34. procedure::ComputerScience=`A named piece of code that does something for a caller'.
      35. procedure::java=a void function.

      36. public::modifier=indicates that a class, field, or function can be used by anything and anywhere on the internet.

      37. private::modifier=indicates that a class, field, or function can only be used locally inside a class.

      38. protected::modifier=A degree of hiding lie between public and private, subclasses and classes in the same package have access to these items. -- unsafe since any class can claim to be a member of the same package! (Thank you, Andrew, for clarifying this definition).

      39. package::=a collection of classes, encode as files in a common directory, that has the same name as the package and are allowed special access privileges. The default scope/access for a function or class is to its package. If no package is declared at the start of a file then the classes etc belong in the deafult global package.

      40. static::=something associated with a class rather than an object.

      41. variable::java=A piece of knowledge associated with a class or an object. Any non-final field.

      42. virtual_machine::=A hypothetical machine that can be emulated on many different actual machines.

      43. 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.

      44. WWW::="World Wide Web".

      45. URL::="Universal Resource Locator'.

        Also see [ java.glossary.html ]

      . . . . . . . . . ( end of section Glossary) <<Contents | End>>

      Syntax

        Introduction

        The syntax of Java is close to C++ but a lot more verbose.
      1. syntax::= See http://cse.csusb.edu/dick/samples/java.syntax.html.

        In outline a java file starts with an optional package declaration and some import statements:

         	package whatever;
          import package.subpackake.class
          import packack.package.*
        These are followed by a sequence of class and interface declarations:
         		modifiers name extends class possible_interfaces{
         			field and function definitions
         		}

        Field definitions have two forms:

         		modifiers type name;
        and
         		modifiers type name = initial value;
        where a type is either a classname or a simple data type like 'int' or 'char' or 'double'. If the modifiers include 'final' then the field is a constant, othewise it is a variable. The following is a very common and useful type of declaration:
         		modifiers type name = new type(arguments);

        Arrays are declared like this:

         		modifiers type name[] = new type[size];
        You can omit the initializer -- and name will be NIL!
         		modifiers type name[];
        The array must not be used until it is initialised in a staement like this:
         		 name = new type[size];

        In either case, if the 'type' is a class(like Object or Applet), the individual objects must be constructed and put in the array before they are used.

         		name[0] = new type;
         		name[1] = new type;
        perhaps.

        Function definitions have form

         		modifiers return_type name(arguments){
        			local definitions and statemants
         		}
        the return_type above is "void" or the name of a class or simple data type. modifiers are listed in the glossary. In older Java only variables (fields) can be defined as local.

        Statements have following main forms:

         		variable.function_name(arguments)...;
         		class.function_name(arguments)...;
         		variable = expression;
         		while(expression) statement
         		if(expression) statement
         		if(expression) statement else statement

        Expressions are typical arithmetic, relational, conditional, expressions of C or C++ plus

         		variable.function_name(arguments)...;
         		class.function_name(arguments)...;

        Java allows you to declare local variables and constants inside a function. You can declare a new variable or constant at any place in a function but you can not define the same identifier in different blocks. This causes a common error with for statements like this:

         		for(int i=0; i<array.size; ++i) {...}
        You must not declare i anywhere else in the same function! This constraint makes the interpreter much simpler and possibly faster since all space for local data is allocated when the function is called rather than when it is declared.

        For a detailed description of the syntax of Java see [ java.syntax.html ] at this site. The following definitions define the syntax of UNIX and HTML related to Java.

        Meta-Notation

      2. O(X)::=Optional X. #(X)::=any number of X's including none.
      3. quoted(X)::= double_quotes X double_quotes.
      4. tagged(X)::= less_than X greater_than.

      5. number::=one or more digits.

        UNIX

      6. CLASSPATH::UNIX_variable=Tells java tools where to to look for classes.

      7. UNIX_path::=directory #(":" directory).

      8. appletviewer::command=Scan HTML file for Applet tag and display its appearance.

      9. binary::=A file that can be loaded and run as a program which uses the machine's own language.

      10. java::command=run compiled class name (_). -- not the name of a class file!

      11. javac::command=compile Java source code file named (_) generating one or more *.class files.

      12. javadoc::command=Extract HTML documentation from Java Source code file named (_).

      13. javap::command=Disassemble a bytecode class (_).


        (filenames):

      14. name_of_class_file::= class_name ".class". -- watch out for case sensitivity.

      15. name_of_java_file::= class_name ".java".

      16. class_name::=identifier, appearing as name of class in class definition.

      17. name_of_HTML_page::=UNIX_file_name ".html".

        HTML

      18. applet_in_html::= applet_tag #(applet_parameter_tag) O(alternative_html_text) end_applet_tag.

      19. end_applet_tag::=tagged("/APPLET").

      20. applet_tag::= tagged( "APPLET" applet_tag_attributes ).

      21. applet_tag_attributes::=O(alignment) O(codebase) code width height O(alternative) O(name) O(vertical_spacing) O(horizontal_spacing).

      22. code::="CODE=" quoted(name_of_class_file), -- relative to [ code_URL ] & [ codebase ] below.

      23. width::="WIDTH=" number. -- in pixels

      24. height::="HEIGHT="number. -- in pixels

      25. alignment::= "ALIGN=" ( "LEFT" | "MIDDLE" | "RIGHT" ).

      26. codebase::= "CODEBASE=" quoted(code_URL).

      27. code_URL::=the URL of the directory that contains the applet's code.

      28. alternative::= "ALT=" quoted(text).

      29. name::="NAME=" applet_instance_name.

      30. vertical_spacing::="VSPACE=" pixels.

      31. horizontal_spacing::="HSPACE=" pixels.

      32. applet_parameter_tag::=tagged("PARAM" "NAME=" quoted(name) "VALUE="quoted(value)

      33. app_in_html::=tagged( "APP CLASS="name_of_class) ), --obsolete

      34. future_HTML::=tagged("embed" arguments) alternative tagged("/embed").

      . . . . . . . . . ( end of section Syntax) <<Contents | End>>

      Predefined Classes

      Java is a small language that gets much of its flavor and power from a very large and expanding library of predefined classes. Sun has provided a collection of packages in the Java run-time library -- see a rough introduction to some commonly used classes and interfaces [ java.classes.html ]

      In theory at least the library includes all the public classes that have been put on the WWW as well!

      For more see on what Sun provides see

    1. packages::= See http://cse.csusb.edu/dick/samples/java.packages.html. Also see the local definitions of the
    2. hierarchy::= See http://cse.csusb.edu/dick/samples/java.class.tree.html.
    3. classes::= See http://cse.csusb.edu/dick/samples/java.syntax.html. and the Official Java(TM) 2 Platform, Standard Edition, v1.2.2 API Specification [ index.html ] As_is http://java.sun.com/products/jdk/1.2/docs/api/index.html

      Javascript is Not Java

      Javascript is a scripting language that extends HTML. In stead of having a tag that names an applet, you have a tag (<SCRIPT> that contains the script inside the page. It was invented by Netscape to allow people to write programs to generate pages dynamically. Javascript programs are placed in between <SCRIPT> ... </SCRIPT> tags in the HTML page and they are executed as the oage is loaded by the user's Browser. They can also be attached to buttons on a page.

      Javascript was once called LiveScript. It is beeing standardized by ECMA (European Standards...) as ECMAScript. Meanwhile MicroSoft has produced its own version called JScript! Even Netscape has 3 or 4 versions of Javascript. The common syntactic ancestor (C++) with Java is clear but the details are quite different to Java. The semantics is closer to Smalltalk than anything else.

      Both Java and Javascript let you produce more complex pages. Both Java and Javascript run on the user's system. A CGI [ CGI in comp.html.syntax ] is executed on the server and sends the results to the client.

      Pointer: comp.lang.javascript [ http://www.c2.org/~andreww/javascript/ ] comp.lang.javascript

      Specification of Java

        Standardization

        ISO is now involved in co-ordinating the development of a standard specification of Java. ISO has granted Sun the privilege of proposing a "fast-track" standard. For details see [ http://www.dkuug.dk/JTC1/SC22/JSG/ ] in Germany. In response to comments from some of the national standards organisations Sun has publicized the URLs of three draft standards: Microsoft would prefer its own version of Java and libraries to be the standard. 10,000 developers who want Java's to be a cross-platform language have formed the Java Lobby [ http://www.javalobby.org ]

        Sun is suing MicroSoft for abusing its licence of Java by giving out a version that will work with only MicroSoft software rather than on all platforms. So far(Winter 1998-1999) Microsoft has been ordered to stop giving out their polluted version and have been forced to distribute an upgrade to the "Pure Java" version.

        Other Specifications

        There is a short glossary of the terms used in Java [ java.glossary.html ] in my local samples of formal documentation.

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

        The syntax (1.0alpha) is summarized at [ HEADING75 in javaspec_11 ] , . . . and locally [ java.syntax.html ] in my documentation samples. "The Java Language Specification" has a complete and up to date grammar. For a Lex/Yacc version of the syntax see guavac [ guavac ] at UBC. For a Java compiler-compiler see the Constructor of Useful Parsers, put out by Scott Hudson of Georgia Tech [ home.html ]

        Java has its semantics defined by a compiler that translates the Java source code for a virtual machine (the JVM), There is a detailed specification of the virtual machine. These were once held at http://java.sun.com/doc/vmspec/html/vmspec-1.html or http://java.sun.com/doc/vmspec/VMSpec.ps. I'm looking for up-to-date URLs...

        My own notes on Java semantics are under construction [ java.semantics.html ] in my documentation samples.


        (File Formats): A specification of the format of a .class file was held at [ vmspec_38.html ] http://www.javasoft.com/1.0alpha3/doc/vmspec/vmspec_38.html.

        Java Development Kit.


        (JDK Specs): The Official JDK 1.0.2 Documentation can be found at [ http://www.javasoft.com/products/jdk/1.0.2/ ] , [ http://www.javasoft.com/products/jdk/1.0.2/api/ ] with index listing all classes and methods: [ AllNames.html ]

      . . . . . . . . . ( end of section Specification of Java) <<Contents | End>>

      See Also

        Java on CSci.CSUSB Workstations

      1. workstations::=following

          (Dells): We have two dozen Dell workstations in JB359. They all run the same Linux operating systems as the NECs but are faster. You can access the servers, public directories and Netscape from these machines. They have JDK1.2.2 in directory /share/jdk1.2.2


          (NECs): The are a lot of PC based Linux workstations in JB356 and JB358. You can access the servers, public directories and Netscape from these machines. They have JDK1.2.2 in directory /share/jdk1.2.2


          (SGIs): We had two dozen Silicon Graphics Indigo workstations in JB359. They all had the same JDK and home directories as Indigo. Some did not mount the public web site however.

        Our servers

        Computers to use for Java if you have a csci.csusb.edu account.
        (Gemini): //gemini.csci.csusb.edu for JDK1.2
        (Indigo): //indigo.csci.csusb.edu , or
        (Orion): //orion.csci.csusb.edu , all for JDK1.1.

        Pointers to WWW information on the Java Language

        1. (FAQ): computer-lang/java/programmers/faq [ javafaq.html ]

          [ faq ] [ javafaq.html ] [ javafaq ] local: [ java.FAQ.html ]

        2. (News):
        3. (Samples): local: TBA

          remote: [ index.html ] [ free-counters.htm ] [ ~espresso ] [ http://www.w3.org/pub/WWW/OOP/9606_Workshop/ ] [ phoneCase.html ] [ wallstreetweb ] [ index.html ] [ http://www.inch.com/~friskel/ ] [ http://www.gamelan.com/ ] [ http://www.inmet.com/java.html/ ] [ algintro.html ] [ index.html ]

        4. (Documentation): local: [ Glossary ] [ java.class.tree.html ] [ java.classes.html ] [ java.glossary.html ] [ java.html ] [ java.lang.System.html ] [ java.packages.html ] [ java.semantics.html ] [ java.syntax.html ] [ java.www.sites.html ] [ See Also ]

          remote: [ http://java.sun.com/ ] = [ http://www.javasoft.com/ ] = [ http://www.applets.com/ ] , . . . 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 Sun.com [ http://java.sun.com/tutorial/ ] or download //ftp.javasoft.com/docs/tutorial.html.zip and unzip it into a HTML page.

          A programmer's guide: [ index.html ]

        . . . . . . . . . ( end of section Pointers to WWW information on the Java Language) <<Contents | End>>

        The Source Code

        Start searching here: [ http://www.javasoft.com/ ]

        News and Announcements

        [ http://www.cnet.com/Content/News/ ]

        The Java announcements archive [ http://wuarchive.wustl.edu/packages/java/ ] plus my local archives of announcements: [ java.www.sites.html ] (after July 29th 1996) [ old.java.www.sites.html ] (before July 29th 1996)

        The Java Newbie FAQs from Usenet comp.lang.java: //cse.csusb.edu/doc/java.newbie.FAQ.txt

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

        Also see TeamJAVA [ http://www.teamjava.com:80/links/ ] and HowDoI at Digital Focus: [ howdoi.html ] Also see Earthweb's Java Directory on www.Gamelan.com [ http://www.gamelan.com/ ]

        Bugs and requested features page: [ bugsandfeatures.html ] at Java.soft.sun.com

        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 ]

        USENET NewsGroups
        (newsgroups):
        (computer Language): comp.lang.java.announce comp.lang.java.security comp.lang.java.programmer comp.lang.java.tech comp.lang.java.misc comp.lang.java.advocacy comp.lang.java.setup comp.lang.java.corba comp.lang.java


        (tools): alt.www.hotjava comp.compilers.tools.javacc

        Tutorials

        Locally:
        (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 ] There is aso a pair of tutorials/labs that cove similar ground more quickly and lightly: [ lab09.html ] [ lab10.html ]

        At Fairfield: [ java.html ]

        Or download, unzip, and browse thru Sun's tutorial: //ftp.javasoft.com/docs/tutorial.html.zip

        Marty Hall's Tutorials [ #Tutorials ]

        Books

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

        Examples etc for "Java in a Nutshell" //ftp.ora.com/published/oreilly/nutshell/java/

        Local 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 ]

        Source Code Examples

        [ http://www.Planet-Source-Code.com/PlanetSourceCode/ ]

      . . . . . . . . . ( end of section See also) <<Contents | End>>

      Trivia


      (CAFEBABE): On UNIX a compiled class can be recognized because it will contain a 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.

    . . . . . . . . . ( end of section The Java Programming Language) <<Contents | End>>

End