If your mind questions “What is the big deal about this? How is the programming language connected to a platform anyway?”; then let’s revisit the process of compilation and execution. A compiler in YOUR machine running on YOUR operating system is intended to translate the code YOU write into the language YOUR machine understands. Doesn’t it just make sense? When in meeting with a German, you need a German translator and if your guest happens to be a Russian you need a Russian translator. But what if you have a person who can translate your sentences into any language you want! That is precisely what Java offered. YOU write your code and Java ensures that your code runs ANYWHERE.
How is this possible? How is Java compilation different from other languages? Try getting the idea from the comparison diagram below.

You should’ve got an idea by now. But let me give in another hint to make the understanding better. Imagine that the interpreter you have writes down whatever you dictate in some code language that all his colleagues understand. So depending on your guest, the correct translator would be put in place and he would take up the notes from your translator and convey your message to the client. This way you have just one translator who shares just one language with you and hence irrespective of your guest, your translator and you are going to speak in the same way.
This is precisely what happens in Java. The Java code you write is translated by the Java compiler into something called a BYTE CODE. You could think of this byte code as the code language in our translation example. This byte code is taken up by the Java Virtual Machine (JVM) and the JVM translates this byte code into the platform dependent code. So ultimately the JVM is PLATFORM SPECIFIC. In other words, you will have a JVM for Windows, a JVM for Linux and a JVM for Mac. But all these JVMs work on the common format – the byte code and translate that to the OS specific machine code. This way you are free from platform specific code and you WRITE your code ONCE and RUN it ANYWHERE.
Wanna Relax? Checkout http://forwardszone.blogspot.com.
No comments:
Post a Comment