before we introduce the Java Platform how about answering a very basic question
What is a PC?
Take your time
The dictionary definition of computer is that it is an electronic device capable of performing computations
It has many peripherals like a monitor and keyboard to accept or display data to users and memory to store information
But the heart of the computer is its processor which does all the thinking for the computer?
Coming back to our definition of computer you may have noticed the key word electronic
Thinking of it if a computer is an electronic device. How can it understand and display text?
images [videos] and other Rich media information
Well a computer understands only
electronic signals where a 5 volt current represents a binary 1 and a 0 volt current
represents a binary 0
Your PC is continually bombarded with these electronic pulses which it interprets
8 bits of such signals are grouped together and text
Numerical and symbols are identified by unique patterns of these 8 electric pulses
for example the pound symbol is represented by the pattern 1 0 1 0 1 0 1 0
instruction to add two numbers is represented by Pattern
1 0 0 0 0 0 1 1
This is 8-bit computing
Current day processors are capable of understanding and decoding 64 bits at a time
Suppose you are asked to write a program to add two numbers say add one with two
Assembly language is the most elementary form of software development languages?
your code to add two numbers in this [language] would look like store number [one] at Memory location say A
store number two at Memory locations say B
add contents of location a and B store results
The way you feed this code to the processor would depend on the PC. You are using
Back in the 50s when computers were huge and consumed a great deal of power
you would convert your assembly language code into corresponding machine code of ones and zeros using mapping sheets and
Punch the machine code into punch cards and then feed those punch cards to the computer
With advancement in technology I/o devices were invented you could directly type the program into the PC
using a program called
Assembler
Converted into corresponding machine code and feed that to your processor
That apart you will also have to make calls to operating systems
providing functions to display the output of code
With advancement in software development languages this entire assembly code could be shrinked into just one line printf
1 + 2
A software called compiler is used to convert your C language code into assembly code and the Assembler converts it into
corresponding machine code
Though Present-day compilers come bundled with assembler they can directly convert your higher language code into machine codes
Now suppose windows operating system is running on this intel processor
Combination of operating system plus the processor is called the platform
The most common platform in the world is the windows and intel called the wintel platform
the other popular platforms are amd and Linux
power PC and Mac os x
Now with change in processors the Assembly instructions will change
For example the add instruction in intel may be called addition for amd
or math add for PowerPC and
Obviously with change in operating system the level and nature os level call. We'll also change as
A developer I want my software program to work on all platforms available to maximize my revenues
So I would have to buy separate compilers which convert my printf command into the native machine code
But compilers come expensive and there's a chance of compatibility issues
Enter Java language the code to display addition of two numbers is system. Dot out dot
printIn
1+2 saved as a dot Java file
Using the Java compiler the code is converted into a intermediate code called the bytecode
The outcome is a dot class file
This code is not understood by any platform, but only a virtual platform called the Java virtual machine
This virtual machine resides in the ram of your operating system
when the virtual machine is fed with this bytecode [it] identifies the platform it is working on and
Converts the bytecode into the native machine code in
fact while working on your PC
Or browsing a web whenever you see either of these icons be assured the Java virtual machine is loaded in your ram
But what makes Java lucrative is that code once compiled can run not only on all PC platforms?
But also Mobile's or other electronic gadgets supporting Java
Hence Java is a language as well as a platform