Introduction to Java

java dev.to

What is Java?

Java is a high-level programming language used to build:

Web applications
Mobile apps (Android)
Software systems

Java is Write Once, Run Anywhere (WORA) language
meaning: one code → can run in any OS (Windows, Linux, Mac)

Why Java?

Java is popular because:

✔ Platform Independent (any OS la run aagum)
✔ Secure (virus attack low)
✔ Object-Oriented (real world model easy)
✔ Easy memory management (Garbage Collector)
✔ Used in MNC companies (Cognizant, TCS, Infosys, etc.)

Java Architecture (Simple Diagram):

Java Program (.java)

Compiler (javac)

Bytecode (.class file)

JVM (Java Virtual Machine)

OS (Windows / Linux / Mac)

Output

What is JVM?

JVM = Java Virtual Machine

✔ It is a virtual machine that runs Java bytecode
✔ Converts bytecode → machine code (OS understand pannum).

What is JIT Compiler?
JIT = Just In Time Compiler

✔ It is inside JVM
✔ Converts bytecode → fast machine code during runtime
✔ Improves performance

JRE (Java Runtime Environment):

JRE = JVM + libraries + runtime tools
What it does:
Provides environment to run Java programs
Contains:
JVM
Java class libraries
Supporting files

DK (Java Development Kit)
JDK = JRE + Development tools

What it contains:
JRE (for running programs)
JVM
Compiler (javac)
Debuggers and tools.

Relationship Diagram:

JDK
└── JRE
└── JVM

Python vs Java Comparison:

Feature Python Java ☕
Syntax Very simple, less code More complex, verbose
Learning Easy for beginners Moderate difficulty
Speed Slower (interpreted) Faster (JVM + JIT)
Typing Dynamic typing Static typing
Code length Short Long
Compilation Interpreted Compiled + Interpreted
Memory management Automatic Garbage Collector
OOP support Supports OOP (flexible) Fully object-oriented
Main use AI, ML, Data Science Enterprise apps, Android
Performance Lower Higher
Popularity Data & AI field Corporate + MNC systems

Source: dev.to

arrow_back Back to Tutorials