Google
 
Site navigation: [ Home | Theory | Java | About ]

Introduction to the Programming Process

Further detail can be found on the machine instruction cycle page.



 

Introduction

Computers can be thought of as a huge collection of switches which can be on or off (in any one of two states). All the information presented by a computer is really stored in this form, known as machine code .

Because the machine components are always in one of two states, often the term binary machine code is used and the binary number system employed to describe the computer at this level.

A binary machine code program (or data stored in the computer might be represented like this:

0001010011100110
0001001100001111
1010001110101100
1001010000111011


This is tedious for humans to work with and they tend to make lots of mistakes when trying to do so. The first step for computer engineers was to make codes which could stand for binary instructions thus ADD might correspond to the code for adding two numbers together, LDA might correspond to the for code fetching a number from memory (LoaDing the Accumulator). Thus a low level language might express the above as:

LDA 2309
ADD 2310
MLT #002
STO 2325


This language is also known as Assembly Language and there is a one-to-one correspondence with machine code. Of course, this is still not very easy to handle so the next step was the development of High Level Languages (HLL's). One HLL statement usually translates into many machine code statements, you might see something like:

Z = (Y + X) * 2

Which could be the High Level language equivalent of the four assembly language statements given above. Clearly the High Level language is more easily understood and it is also possible to develop specific high level languages for specific tasks. There are said to be over 2000 high level languages in existence.

So computer programming is the business of writing code in one of these languages and then having another computer program translate that into binary machine code.

back to top

How the Java Language Works

Many languages are either compiled or interpreted but Java is a mixture of the two. The code you write in an IDE (or in Notepad or another simple editor) is a Java source file with the extension .java.

The javac.exe program (usually found somwewhere within the set of folders under a folder called "java" with your other program files) transforms your text to a series of "bytecodes" - a compressed form of the language. Some other Classes which are pre-compiled to bytecodes may be linked with your program at this satge.

This bytecode program is executed by the java interpreter java.exe which may call additional executable code at runtime as needed.

The Java Virtual Machine, as the bytecode interpreter is called, has to be written for each hardware platform that Java runs on (since it turns bytecodes into machine code) but the bytecodes can be run on any machine equipped qith the correct implementation of the JVM.

back to top

Related: [ Java Home | next:getting started with BlueJ ]

Detail on how Java executes a program...


 
The site is partly financed by advertising revenue, partly by online teaching activities and partly by donations. If you or your organisation feel these resouces have been useful to you, please consider a donation, $9.95 is suggested. Please report any issues with the site, such as broken links, via the feedback page, thanks.

Questions or problems related to this web site should be addressed to Richard Jones who asserts his right to be identified as the author and owner of these materials - unless otherwise indicated. Please feel free to use the material presented here and to create links to it for non-commercial purposes; an acknowledgement of the source is required by the Creative Commons licence. Use of materials from this site is conditional upon your having read the additional terms of use on the about page and the Creative Commons Licence. View privacy policy.

Creative Commons License


This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. © 2001 - 2009 Richard Jones, PO BOX 246, Cambridge, New Zealand;
This page was last modified: October 28, 2013