"Equations as complex as neural networks had been scraped into the frost. At some point in the calculation the mathematician had changed from using numbers to letters, and then letters themselves hadn't been sufficient; brackets like cages enclosed expressions which were to normal mathematics what a city is to a map... This was math without numbers, pure lighting.. They narrowed to a point, and at the point was just the very simple symbol: "=". 'Equals what?' said Cuddy. 'Equals what?' "
Terry Pratchett "Men At Arms", p.196
According to Niemeyer and Knudsen (Learning Java), simplicity rules when it comes to Java syntax which they call "Syntactic Sweet n' Low". A Java program is written one public, top-level class to a file, which must have the same name as the class. Each Java file is compiled into a .class file for execution by the Java interpreter (remember that Java is both a compiled and interpreted language). Multiple inheritance is not allowed nor is operator overloading.
Java does not have a
goto statement (although
goto is a reserved
continue statements as well as exception
handling fulfill this function.
The Java programming language, owned by Sun and developed through a community process has one definitive source for documentation: Sun's website.
In addition, any Java code can be automatically documented through the use of the (free) javadoc program from Sun. This program scans Java code and creates an HTML page for each class, describing the data types and methods found in this class. Comments in the source code are also incorporated into the documentation if they begin with /** (instead of /* ). There are dozens of special tags which can also be used. For example, @author indicates the author, @version the version etc. For a full listing see http://java.sun.com/j2se/javadoc/writingdoccomments/.
There are a number of tools available to help with using and structuring Java language programs. One tool will take "foreign" Java code and add spaces and indentations according to your directions. Javah will read in a Java .class file and produce a C++ .h header file which can be used to call C++ code from Java.
For the most part, Java uses the operator precedence and
associativity found in C. Java does include a short hand ternary
operator which can be used in place of "if else":
x > y
? x : y
There are a few unexpected quirks. For example
j = ++i is NOT the
same expression as
j = i++. Also,
j = j + 1 is NOT the same as
j with a side effect. In the first case,
j is evaluated
twice, in the second only once.