How java is platform independent:
Java is a platform independent language, which means the java program can be executed on any platform in the world, whether it is a different architecture hardware / processor or different operating system like Linux / Unix, Macintosh, Windows etc.
Let’s discuss how it is achieved in java, let’s take a real example so that it will be easy to understand the platform in-dependency.
This is the scenario - I am an Indian and I have written a letter in Hindi language (Hindi is a national language of India), and obviously no one in the world knows Hindi language except Indians. Now, let’s assume that I have hired multiple agents who know Hindi and the native language for separate countries, for example I have hired an agent for America who knows Hindi and US English, an agent for China who knows Hindi and Chinese, an agent for France who knows Hindi and French, similarly for other countries as well.
In exactly similar way the java has implemented and ensured the platform in-dependency. Here we can assume the Hindi language as a Byte Code, and respective agents as Java Virtual Machines. The programmer writes program in high level language, then java compiler convert the program in byte code and generates the “.class” file, the .class is equivalent to Letter in Hindi Language,further the byte code is converted to machine understandable language by Java Virtual Machine which is equivalent to the respective Country Agents.
So, the complete java platform is a ensured platform in-dependency in this way, which can be executed in any hardware architecture or any operating system. We just need to install machine or OS specific JVM / JRE in order to execute the java byte code.
No comments:
Post a Comment