What is Java?

2 What is Java?

Java is a new interpreted language developed by Sun Microsystems. Today, it is primarily used as a way of incorporating small programs into documents on the World Wide Web. Since Java is interpreted, Sun was able to make Java platform independent, making it ideal for this purpose. There are many other modern features to Java that contribute to the hype and excitement about the language today. Several of the undergraduate labs use it as their primary programming language.

Before you can begin running Java programs in the lab, you should know a bit about how Java works. This will help you understand the compilation and interpretation phases of making Java programs.

Although Java programs are interpreted, they are also compiled. The Java interpreter understands so-called Java byte code which is more efficient to interpret than the Java code that you can read. So a Java program must first be converted from Java code to Java byte code before it can be run.

You should be aware there are two flavours of Java programs: applications and applets. The difference here is largely in what the interpreter allows the program to do. I mentioned before that Java is a popular language for the web; however there are security risks associated with running a stranger's code on your machine. To address this concern, a Java applet interpreter puts significant restrictions on what an applet can do. For example, it can't write files to your local file system and thereby erase possibly precious documents. Java applications, on the other hand, are designed to behave like any other program.

There are also differences in the environment applications and applets run in. Predictably, applications are designed to be run from the command line like other programs. Applets are run from within a web browser, such as Netscape. The browser reads an HTML file containing a reference to a Java applet and then runs it. (HTML is the document language for the World Wide Web - you are reading an HTML document now).
Next 3 Compiling Java Classes

David Maxwell, who is still writing this, would like to hear your comments and suggestions.