The meaning of platform independent is that, the java source code can keep running on every operating system.
A program is written in a language which is a comprehensible language. It might contain words, phrases and so forth which the machine does not understand it. For the source code to be known by the machine, it should be in a language understood by machines, ordinarily a machine-level language. Along these lines, here comes the role of a compiler. The compiler changes over the abnormal state language into a configuration understood by the machines. Accordingly, a compiler is a program that deciphers the source code for another program from a programming language into executable code.
This executable code might be an arrangement of machine guidelines that can be executed by the CPU specifically, or it might be an intermediate representation that is translated by a virtual machine. This intermediate represented in Java is the Java Byte Code.
Step by step Execution of Java Program:
In case of C or C++ the compiler produces an .exe file which is OS dependent. When we attempt to run this .exe file on another OS it doesn’t run, since it is OS dependent and thus isn’t compatible with the other OS.
Java platform is independent but dependent on JVM platform
In Java, the main point here is that the JVM relies upon the operating system – so on the off chance that you are running Mac OS X you will have an alternate JVM than if you are running Windows or some other operating system. This reality can be confirmed by trying to download the JVM for your specific machine – when attempting to download it, you will given a list of JVM’s comparing to various operating system, and you will clearly pick whichever JVM is focused for the OS that you are running. So we can complete that JVM is platform dependent and it is the reasons why Java is able to become “platform Independent”.
This article is contributed by professional java trainers of java training in Chandigarh.