DEV Community

Cover image for How Java Works? ๐Ÿš€
Anush
Anush

Posted on โ€ข Edited on

1 1 1

How Java Works? ๐Ÿš€

Image description

1.Compilation:

  • Java source code is written in human-readable form by developers. This source code typically resides in files with a .java extension.
  • The Java compiler (javac) translates the source code into platform-independent bytecode. Bytecode is a set of instructions for the Java Virtual Machine (JVM) and is stored in files with a .class extension.

2.Java Virtual Machine (JVM):

  • The JVM is a virtual machine that provides an execution environment for Java bytecode.
  • When a Java program is executed, the JVM loads the bytecode files generated by the compiler.
  • It then interprets the bytecode instructions and translates them into native machine code instructions that are specific to the underlying hardware and operating system. This translation can be done dynamically during program execution using techniques like Just-In-Time (JIT) compilation.
  • The JVM also manages memory allocation and deallocation, garbage collection, exception handling, and other runtime tasks.

3.Execution:

  • Once the bytecode is loaded and translated by the JVM, the Java program begins execution.
  • The JVM follows the instructions provided by the bytecode, executing the program's logic step by step.
  • Java applications can interact with the underlying system through APIs provided by the Java standard library and other libraries.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

๐Ÿ‘‹ Kindness is contagious

Please leave a โค๏ธ or a friendly comment on this post if you found it helpful!

Okay