Advances in Computer Science

Written by Mojgan J. Akhavan, M.S.,Computer Science.

What is Java Anyway?
Java Introduction page, provides a good Java description
Java Question and Answer page.

Mojgan's Other Writings

Iranian Weddings,
the new addition
the newest addition
Knowing My Father.

Introducing Java.

If you are even slightly involved in using the Internet, you've been sure to sense all the excitement over Java! But what is Java anyway? In technical terms, Java makes it possible to distribute executable content across local and wide area networks, including the public Internet. That means, for example, a user that wishes to access a movie from a server, would not only download the movie data, but also a "wrapper application," or program, which can play the movie on the user's computer. Java executables are referred to as applets, meaning small applications. These applets run within a protected environment that comes with any Java-capable browser.

An enormous advantage to this approach is that it makes programs written in Java independent of any particular machine and/or operating system. Any Java applet can run on any Java-enabled computer regardless of the platform. It doesn't matter whether the machine is a PC, Mac, or UNIX workstation. As Sun puts it, "Java makes it possible for applications to be written once and run anywhere."

How does Java work?

This part gets kind of technical, so just hold on! In order for software to be used, its instructions must be converted into the native language of the machine they are to be executed on. Because this translation is consumptive of machine resources and takes a long time, applications are typically delivered to the end-user in compiled (i.e. already translated) form. This, however, creates a problem in that the code must be delivered in a different compiled form for each platform. For example, code compiled for a Mac will not run native on a Windows PC.

In order to insure that Java offers high performance, Sun designed it so that it is delivered partially compiled. However, in order to make it possible for Java to be architechture-neutral, Sun designed the language so that it is also partially interpreted. Pretty neat, huh?

A rather ingenious method was devised in order to achieve this. Java code is first compiled into what is known as Bytecode. Bytecode is composed of instructions that have been brought to the lowest level possible without making them machine dependent. Creating Bytecode does about 80% of the compilation work. However, one set of Byte-code can run on any Java-enabled computer. The last 20% is performed at runtime by the Java environment provided by the machine-specific browser. In this way Java offers both portability and performance.

Because Java is partially interpreted, it is not only architecture-neutral but it also eliminates the version mismatch problems that typically plague the application developer. In other words, all external program references are resolved when the application is executed.

The Java language.

The Java language is based on C++. However, Sun has purposefully not implemented some C++ capabilities. Why? The answer lies in the fact that the C++ capabilities that Sun left out are those that tend to create the most problems in applications.

For example, C++ provides programmers with the ability to use "pointers." A pointer can be thought of as an address to a particular location in a computer's memory. In other words, data residing in a computer's memory can be accessed via its pointer. This capability, however, can cause significant problems. A careless programmer might write code that accesses data outside of the memory space allocated for his/her paricular program. Java goes a long way toward eliminating these problems by tightly controling the memory used by programs. Java provides alternatives to the more troublesome features of C and C+, which makes programs written in Java inherently more stable and secure.

Useful Java links and resources.

Java Introduction page provides a good and to-the-point Java description.

Java Question and Answer page answers common questions about Java.

My Web Page has a handful of little applets, just for FUN...please be patient.

Sun's Java home page is a good place to start. Included are some white papers on Java as well as free software.

GAMELAN's page is full of sample Java applets. Some even include the code!

Internet World 60 Minute Guide to Java, by Ed Tittel and Mark Gaither. This book provides a general overview of Java.

*note: in order to see Java demos, make sure you are using a Java-capable browser, like Netscape's.

Document last modified Friday, 26 July 1996 by