Although Java and JavaScript have similar names and a couple of similar types of statements, they are very different programming languages. Java is a much more powerful language that was first developed for implementing programs on appliances like Cable TV boxes, microwaves, etc. They wanted the language to be independent of the processor that the programs would be run on, since the processors used in consumer applicances might vary. They wanted the language to be tight and efficient (not requiring a lot of memory or processing power).


Java programs are somewhat unique in that they are machine independent. The Java compiler translates Java code into byte-code, rather than machine code. Byte-code is an intermediate translation that does not include machine-specific details. To run the byte-code, we can either use a Java interpreter or run the byte-code on a Java-enabled browser. If we use a browser, the program is referred to as an applet, rather than an application. The Java compiler can be obtained free from Oracle.


Java is a strongly typed language. That means that you must declare variables to be a certain data type and they cannot hold data of a different type. Java is object-oriented and, in fact, all functions (or methods) must belong to some class in a Java program. There are no stand-alone functions in Java.


How XHTML handles Java and different browser support has changed dramatically since this tutorial was originally created. This section will be updated at a later date.


References

  1. Dietel, H. M., Dietel, P. J. & Neito, T. R. (2001) Internet & World Wide Web: How to Program. 2nd Edition. Prentice Hall, NJ.

Introduction to Web Design by Cynthia J. Martincic :: Credits