Essentially, whereas most software must be re-written for each operating system, software written in Java need only be written once. This remarkable feat is achieved by means of the "Java Virtual Machine", a piece of software which translates between the software and the OS.
Java's one disadvantage is that the Virtual Machine imposes a performance overhead on any Java application, slowing its performance.
A special type of compiled Java program, called an "Applet", may be placed in an HTML Web page, perhaps in order to introduce interactivity.
Java can also be used to create small programs called "Cookies", which webmasters use as a way of profiling and tracking visitors to their sites.