Java Reference
In-Depth Information
4.
In the fourth stage, you will learn how you can segment the activities that your programs carry out
into separate tasks that can execute concurrently. This is particularly important for when you want
to include several applets in a web page, and you don't want one applet to have to wait for another
to finish executing before it can start. You may want a fancy animation to continue running while
you play a game, for example, with both programs sitting in the same web page.
5.
In the fifth stage you will learn in detail how you implement an application or an applet with a
graphical user interface, and how you handle interactions with the user in this context. This
amounts to applying the capabilities provided by the Java class libraries. When you finish this stage
you will be equipped to write your own fully-fledged applications and applets in Java. At the end of
the topic, you should be a knowledgeable Java programmer. The rest is down to experience.
Throughout this topic we will be using complete examples to explore how Java works. You should
create and run all of the examples, even the simplest, preferably by typing them in yourself. Don't be
afraid to experiment with them. If there is anything you are not quite clear on, try changing an example
around to see what happens, or better still - write an example of your own. If you are uncertain how
some aspect of Java that you have already covered works, don't look it up right away - try it out.
Making mistakes is a great way to learn.
The Java Environment
You can run Java programs on a wide variety of computers using a range of operating systems. Your
Java programs will run just as well on a PC running Windows 95/98/NT/2000/XP as it will on Linux or
a Sun Solaris workstation. This is possible because a Java program does not execute directly on your
computer. It runs on a standardized hypothetical computer that is called the Java virtual machine or
JVM , which is emulated inside your computer by a program.
Java
Compiler
Java
Source
Code
Java
Object
Code
Object code is
verified and loaded into
the Java virtual machine
Java virtual machine
The program is executed
by the interpreter
Java interpreter
The interpreter handles all
communication with the
operating system for the
real machine.
Computer Operating System
Search WWH ::




Custom Search