SE251:StudentClarifications:Lec1

From Marks Wiki
Jump to navigation Jump to search

Lecture 1 - Course and Java Overview

Lecture slides

The Java virtual machine (JVM)

The java virtual machine is a program which must be installed on a computer before that computer can run any java programs. I believe it is written in C++ (though it may depend which version), but versions are available for most (all?) common computing platforms. It is required because java is not compiled to machine code which your computers processor can understand, but instead to bytecode. Bytecode is not tied to any particular computer architecture, so the virtual machine can convert the bytecode into whatever machine code is appropriate for your computer before it runs the program. This allows the same bytecode to be run on windows, linux, mac, and the super computer you found unguarded in the lab next door.

Applets

An applet is simply a java program that is downloaded from a server to your computer along with a web page. You have probably come aross them before. The <applet></applet> html tags indicate to your web browser that it should download and run a particular applet. Java can be used for more than just applets, it can also be used for console programs (like we have been writing in C) and normal applications. If a java program is intended to be run as an applet, it's main class must inherit from JApplet so that the browser can correctly run and stop it (don't worry if you don't know what I mean by inherit yet).