Home
Examples
Labs
Assignment
Marks
Midterm
Final Exam
Resources

About the Computer

  • CPU - Central Processing Unit, sometimes called the "brain" of the computer.  The CPU is the part of the computer that actually runs your programs.  It is the CPU that executes program instructions and carries out arithmetic.


  • Input & Output - Communication between your computer and the rest of the world.  Information is entered into the computer using input devices like the mouse and the keyboard.  The computer returns information to the user through output devices like the monitor and the printer.


  • Memory - Main memory is a large ordered collection of bits that are grouped into bytes.  Imagine memory as being a series of slots where the computer can store things like program instructions and data.  Before you can run a program it must be loaded into memory.  The CPU is only able to access things that are in main memory.


  • Operating System - The operating system (OS) is the most important program on your computer.  The operating system is needed to run other programs.  The operating system handles input and output, keeps track of your files and directories, controls peripheral devices like the keyboard and mouse, and takes care of system security and the sharing of system resources.



About Computer Programs

  • Source Code - Program instructions in their original form.  Source code is readable by humans, but not directly executable by computers.  When you write java programs you are writing source code.  Files that contain java source code must be named with a .java extension.


  • Compiler - A special program that takes code written in a high level language like java, and translates it into some other language (usually machine language).  Typically, a compiler takes an input file of human readable code, and produces an output file containing code that can be executed by the computer.


  • Byte Code - When java source code is compiled, the result is java byte code.  Java byte code is stored in .class files.  Byte code is not readable by humans.  Don't try to open and view your .class files.


  • Interpreter - A special program that directly carries out the statements of a high level programming language.  An interpreter is similar to a compiler, but interpreters do not generate an output file for execution at a later time.  Interpreters execute computer programs on the fly, line by line.



Platform Independence

Java is a unique language because it is both compiled and interpreted...
  • We compile .java files to convert the source code to java byte code.
  • The byte code is stored in .class files, and can be executed by a java interpreter running on any computer.
  • A java interpreter running on a Macintosh computer interprets byte code to instructions that the Macintosh platform can understand and execute.  A different interpreter running on a UNIX computer takes the same byte code and interprets it to instructions that the UNIX platform is able to understand.
  • In this way, the same java program can be run on any computer that has a java interpreter.
  • The java interpreter is called the Java Virtual Machine.
  • We run the java virtual machine by typing the word "java" at the command prompt.