Is Java Platform-Independent?
Yes, Java programming language is a platform-independent programming language because the Java compiler converts the source code to bytecode, and the bytecode is an Intermediate language. Bytecode can be executed on any platform (Operating System) using
JVM ( Java Virtual Machine) BUT for more understanding, we need to know about:
- What is Platform?
- How to execute a Java program?
- What is the difference between a byte and native code?
Platform
The platform is a combination of processor, operating system, and Hardware (specifically the CPO architecture).
Execute a Java Program
When we compile a Java program that program is directly converted into a machine-readable language which means (.exe) file. This (.exe) file is specific to the operating system.
Native Code
This (.exe) file is called the Native Code which is similar to the machine code.
Byte Code
Byte codes are nothing but intermediate codes generated after compilation and it is not executable code like Native code.