Jumping into Java....................
Java is a high level programming language.
Java was initially named Oak in 1991 by its creator James Gosling.
The name was later changed to Java, inspired by Java coffee from Indonesia
There are so many features
First lets see how Java is said to be platform independent.
to completely understand about platform independency, first lets understand platform dependency.
Platform dependency
When you write a program in C, the C compiler converts your human-readable source code (.c) into machine code (binary) that the computer can execute.
If you compile on Windows, the compiler produces Windows-specific machine code.
This code is designed for Windows OS and possibly the Windows version of the CPU instructions.
ie..the machine code generated for same program on different operating system is different.so Machine code is not portable across different operating systems or sometimes even different CPUs.
â Conclusion: You cannot directly run a Windows-compiled C program on Linux.
To Make it work on Linus OS,recompile the source code on Linux using a Linux C compiler.

Platform Independent:
Lets see deeper into Java Platform Components - JDK,JRE,JVM,JIT
JDK
JDK is Java Development Kit.
This is used to write,compile and run the java programs.
It contains the JRE and a set of development tools,
compiler (javac), debugger, and utilities like jar and javadoc.
Provides the JRE, so it also allows running Java programs.
Required by developers to write, compile, and debug code.
Components of JDK:
JRE (JVM + libraries)
Development tools (compiler, jar, javadoc, debugger)
Note:
JDK is only for development (it is not needed for running Java programs)
JDK is platform-dependent (different version for windows, Linux, macOS)Based on Processor and OS,we can download JDK in (https://www.oracle.com/java/technologies/downloads/)
Working of JDK:
Source Code (.java): Developer writes a Java program.
Compilation: The JDKâs compiler (javac) converts the code into bytecode stored in .class files.
Execution: The JVM executes the bytecode, translating it into native instructions.
JRE (Java Runtime Environment)
JRE provides an environment to run Java programs but does not include development tools. It is intended for end-users who only need to execute applications.
Contains the JVM and standard class libraries.
Provides all runtime requirements for Java applications.
Does not support compilation or debugging.
Note:
JRE is only for running applications, not for developing them.
It is platform-dependent (different builds for different OS).
JVM (Java Virtual Machine)
JVM is the core execution engine of Java. It is responsible for converting bytecode into machine-specific instructions.
Part of both JDK and JRE.
Performs memory management and garbage collection.
Provides portability by executing the same bytecode on different platforms.
Note:
JVM implementations are platform-dependent.
Bytecode is platform-independent and can run on any JVM.
Modern JVMs rely heavily on Just-In-Time (JIT) compilation for performance.
Now let me explain about Platform independency.
Since Java compiler converts human readable code into "BYTECODE"- which is intermediatory code - neither human readable nor machine readable is highly secured.
JDK is not platform independent ,only BYTECODE is platform independent which makes JAVA -WORA language.
what about JVM? It is also not platform independent.
it plays a part in converting byte code into binary codes.Bytecode is platform-independent and can run on any JVM.





Top comments (0)