Java Programming
BY Ayush
What is Java?
Platform Independent Object-Oriented
The core philosophy of "Write Once, Run Java is built around the concept of objects, which
Everywhere" (WORA). Java code is compiled into contain data and methods. This structure
bytecode that runs on any device equipped with a promotes code modularity, reuse, and easier
Java Virtual Machine (JVM), regardless of the maintenance, making it ideal for large-scale
underlying hardware or OS. application development.
How Java Works
Source Code (.java)
Written by developers in a
human-readable format.
Compiler (javac)
Translates source code into
platform-agnostic bytecode.
Java Virtual Machine
(JVM)
Interprets or JIT-
compiles bytecode into
native machine code
for execution.
Your First Program
• Class Declaration: Every application begins with a
class definition.
• Main Method: public static void main is the entry
point where the JVM starts execution.
• Standard Output: [Link] is used to print
text to the console.
• Syntax: Note the use of braces {} for scope and
semicolons ; to terminate statements.
Data Types & Variables
Category Type Size Description
Primitive int 32-bit Standard integer numbers.
Decimal
numbers
double 64-bit for
precision
.
True or
boolean 1-bit False
values.
Single
Unicode
char 16-bit
characte
r.
Reference String / Objects Varies Complex types that store references to data (e.g., arrays, classes).
Control Flow
Conditionals Loop Branching
s
Use if-else and switch Automate repetitive tasks using Control loop execution with
statements to execute different for, while, and do-while loops break to exit immediately or
code blocks based on boolean to iterate over data. continue to skip to the next
conditions. iteration.
Object-Oriented Pillars
Encapsulation Inheritance Polymorphism
Bundling data and methods, restricting Mechanism where a new class derives Ability of an object to take on many
direct access to internal state. properties from an existing class. forms, enabling flexible code.
Collections Framework
List & Set Map (HashMap)
List (ArrayList): Ordered collection that allows
Stores data in Key-Value pairs. Keys must be
duplicate elements. Good for fast access by
unique.
index.
Ideal for dictionary-like lookups where you need
Set (HashSet): Unordered collection that prohibits
to retrieve values efficiently using a specific key
duplicates. Efficient for uniqueness checks.
identifier.
Modern Java Evolution
• Local Variable Inference: Use var to reduce
boilerplate when type is obvious.
• Records: Concise syntax to create immutable data
carrier classes, replacing verbose POJOs.
• Switch Expressions: A more streamlined and
functional way to write switch statements.
• Text Blocks: Multi-line strings without easier
formatting for JSON/SQL.
Why Java Persists?
Despite the rise of new languages, Java maintains a top-tier position due to massive legacy codebases, continuous
evolution (6-month release cycle), and unmatched ecosystem stability.
Real-World Applications
Enterprise Backend Mobile (Android) Big Data
Powering 90% of Fortune 500 The native language for Android, The backbone of data processing
companies via Spring Boot & Jakarta running on billions of mobile devices giants like Apache Hadoop, Spark, and
EE. worldwide. Kafka.
Questions?
Thank you for your time.