DEV Community

Cover image for Introduction to Java
G Gokul
G Gokul

Posted on

Introduction to Java

Java:

  • Java is a high-level, object-oriented programming language and computing platform first released by Sun Microsystems in 1995.
  • Java is a widely used programming language for building web, desktop, mobile, and enterprise applications.
  • It is known for its simple syntax, portability, and powerful features that make development easier and more secure.

How Java Works:

Write Once, Run Anywhere (WORA): Java code is compiled into intermediate bytecode rather than machine-specific instructions.
Java Virtual Machine (JVM): This bytecode runs on any device equipped with a JVM, making Java platform-independent across Windows, macOS, and Linux.

History of java:

on

  • Java was originally developed under the Green Project by Sun Microsystems for consumer electronic devices.
  • Before becoming Java, the language went through multiple names and finally received its official identity inspired by coffee beans.
  • The language was first called Greentalk, then renamed Oak, inspired by an oak tree outside James Gosling’s office.
  • Since the name Oak was already trademarked, the team later selected the name Java after brainstorming names like Silk, Lyric, DNA, and Dynamic.

Why was Java created?
Java was originally created to solve the software problems of networked consumer electronic devices, such as interactive televisions, set-top boxes, and smart home appliances.

difference between compiler and interpreter:

tion

Architecture of java:

on

  • Java architecture is a multi-tiered system that handles both the compilation and execution of programs, famous for its "Write Once, Run Anywhere" (WORA) philosophy.
  • It translates human-readable Java code into intermediate bytecode, which can then run on any operating system equipped with a compatible virtual machine.

The architecture is divided into two primary concepts: the Execution Flow and the Three Core Components.

1.The Java Execution Flow

The process of running a Java program combines compilation and interpretation:
Source Code (.java): The developer writes code in standard text format.
Compilation: The Java Compiler (javac) converts the source code into an intermediate format called Bytecode stored in .class files. Bytecode is a platform-neutral language optimized for the Java Virtual Machine.
Execution: The Java Virtual Machine (JVM) processes this bytecode, transforming it into native machine code (binary instructions) that the host operating system can execute.

2. The Three Core Components (The "Nested" Relationship)

Java's architecture relies on three primary software components, which act like a set of nesting Russian dolls: JDK contains JRE, and JRE contains JVM.

  • The JDK (Java Development Kit) is a core software bundle used by developers to write, compile, debug, and run Java applications. It serves as an all-in-one environment that translates human-readable Java code into a format a computer can execute.
  • JRE stands for Java Runtime Environment. It is a software package that provides the exact environment needed to run and execute Java applications on a computer.
  • JVM stands for Java Virtual Machine. It is an abstract, software-based computing machine that provides the runtime environment required to execute Java programs.

3.Inside the JVM Architecture

The JVM itself is a complex runtime subsystem divided into four main areas:

  1. Class Loader Subsystem
  2. Runtime Data Areas (Memory Areas)
  3. Execution Engine
  4. JNI and Native Libraries

on

Top comments (0)