java is platform independent....?

Why we can say that java is platform independent

  • Pramod Kulat
  • 11 Oct
  • 170 Answers

170 Answers
  • Java is a platform independent programming language, Because when you install jdk software on your system then automatically JVM are installed on your system. For every operating system separate JVM is available which is capable to read the .class file or byte code. When we compile your Java code then .class file is generated by javac compiler these codes are readable by JVM and every operating system have its own JVM so JVM is platform dependent but due to JVM java language is become platform independent.

  • We can say that Java is platform independent because the java interpretor also known as java virtual machine ,converts the java class file into java byte code . This java byte code is machine independent,i.e,it does not depends on which machine it is run. The java compiler converts this java byte code into respective machine code according to the machine it is run on. Since program in java neither depends  on software or hardware of the machine it is running, hence it is called platform independent.

  • We compile it once and run everywhere.Java can able to run on any platforms such as any OS environment give the same results so that java is a platform independent

  • Because on compilation it generates a bytecode which can be ran on any platform on a condition that JVM is installed on that platform

  • Because the programs and applications developed using java can run on different platforms provided the platform must have JRE.

  • A program is written in a language which is a human readable language. It may contain words, phrases etc which the machine does not understand. For the source code to be understood by the machine, it needs to be in a language understood by machines, typically a machine-level language. So, here comes the role of a compiler. The compiler converts the high-level language (human language) into a format understood by the machines. Therefore, a compiler is a program that translates the source code for another program from a programming language into executable code. This executable code may be a sequence of machine instructions that can be executed by the CPU directly, or it may be an intermediate representation that is interpreted by a virtual machine. This intermediate representation in Java is the Java Byte Code. Step by step Execution of Java Program: Whenever, a program is written in JAVA, the javac compiles it. The result of the JAVA compiler is the .class file or the bytecode and not the machine native code (unlike C compiler). The bytecode generated is a non-executable code and needs an interpreter to execute on a machine. This interpreter is the JVM and thus the Bytecode is executed by the JVM. And finally program runs to give the desired output.

  • Platform Independent refers to, we can write Java program once, we can compile it once and we can run it on different operating systems

  • We can run java programs on any platform

  • Because it has its bytecode which consists of .Class file and 2nd reason is that when it runs in any operation system it doesn't change according to thats os it works itself.

  • We can run java source code in any system irrespective of its platform

  • After compilation of Java code it generates the .class file(aka byte code) which is a machine code. This file can be run on any OS. That why Java is a platform independent language.

  • There is slogan in Java called "Write once run any where" this statement says Java is platform independent.

  • The. Class file can be executed on every machine because each and every machine consist of JRE. So java is independent

  • With Java, you can compile source code on Windows and the compiled code (bytecode to be precise) can be executed (interpreted) on any platformrunning a JVM. So yes you need a JVM but the JVM can run any compiled code, the compiled code is platform independent. ... for that why Java is called Platform independent

  • java programming write on one platform and run on many platforms

  • Yes, because of Java Virtual Machine.

  • Because the bitcode of Java can be run on any platform irrespective of the os . And the written once can be run anywhere.

  • Java works on WORA architecture i.e. write one runs anywhere.
    Now, after the successful compilation of JAVA program Byte code is generated. These Byte code is platform independent. JVM which platform specific, interpretes the byte code and converts them into platform specific instructions.
    So, because of these byte code and JVM.....Java works as platform independent.

  • Yes, Java is a platform Independent Language because the source code run on one machine can be executed on any machine.Java compiler generates the byte code which is executed by the individual JVM on different machines

  • when you Compile a java Source code it generates a bytes Code. Bytes code is platform independent. only you  need a JVM to run this byte code. JVM is available for all operating systems.


Did Not Get The Answer? 
Contact people of Talent-Core Java directly from here

Core Java