● Java is a :-
1. High-level, object-oriented programming language.
■ High-level:A language that is easy for humans to read, write, and understand
(close to English).
■ Object-oriented:A way of programming where everything is designed using
real-world objects like Student, Car, or Bank.
■ Programming language:A language used to give instructions to a computer
to perform tasks.
2. Platform because it provides an environment (JVM + JRE + libraries) to run
applications.
Who made Java?
● Java was created byJames Goslingand his team atSun Microsystems.
● Work started in1991under a project calledGreen Project.
● Thefirst public version (Java 1.0)was released in1995.
● That’s when Java officially became available to developers.
● The language’s original name wasOak.
● James Gosling named it after anoak treeoutside his office.
Why did the name change from Oak to Java?
● The nameOakwas already trademarked by another company.
● T
he team choseJavaas a new name — inspired by coffee culture (they drank lots of coffee
while working).
Basic idea of Java
“ Write Once, Run Anywhere” — the same program could run on different systems using the Java
Virtual Machine (JVM).
● Designed to be: Simple, Secure, Portable
● Features of Java
1. P
latform-Independent:Java applications are designed to run on any platform that has a
Java Virtual Machine (JVM) without requiring modification.
● Bytecode : Java source code is compiled into an intermediate form called bytecode
(.class files). Bytecode is platform-independent and can be executed on any system
with a compatible JVM. This bytecode is portable across different operating systems
and hardware configurations.
2. O
bject-Oriented:Java is built around the principles of object-oriented programming (OOP),
which organizes software design around data, or objects, rather than functions and logic.
● Encapsulation
● Inheritance
● Abstraction
● Polymorphism
3. Robust:Java is designed to be a reliable and error-resistant programming language.
a. Exception Handling : Java uses a structured approach to handle runtime errors
through exceptions. The language provides robust exception handling mechanisms
using try, catch, finally, and throw keywords, enabling developers to handle and
recover from errors gracefully.
b. Automatic Garbage Collection : Java’s garbage collector automatically reclaims
memory used by objects that are no longer reachable, reducing the risk of memory
leaks and ensuring efficient memory management.
c. Type Checking : Java performs strict type checking at compile-time and runtime. This
ensures that operations are performed on compatible data types and helps catch
errors early in the development process.
4. S
ecure: Java Security refers to the built-in features that protect Java applications from
unauthorized access and harmful actions. It uses mechanisms like bytecode verification,
sandboxing, and a security manager to control program behavior and keep the system safe.
5. P
ortable:Java's portability allows compiled programs to run on any platform with a JVM,
ensuring cross-platform compatibility.
a. Bytecode and JVM : Java compiles code into platform-independent bytecode,
executable on any JVM.
b. No Recompilation : Unlike C/C++, Java doesn't require platform-specific
recompilation.
c. Standard Libraries : Libraries handle system-specific differences, maintaining
consistent behavior.
d. Example : A Java app compiled on Windows runs seamlessly on Linux or macOS if
JVM is installed.
6. Simple:Java is easy to learn and use because its syntax is clear and removes complex features
of C/C++.
7. Multithreaded: Java supports running multiple tasks at the same time using threads.
8. Distributed: Java helps create applications that work over networks and communicate with other
systems.
9. Dynamic: Java programs can change behavior during runtime, making them flexible.
10.High Performance: Java gives good performance using advanced JVM technologies.
Uses of Java:
.
1 eb Development
W
2. Enterprise Applications
3. Mobile Applications
4. Desktop Applications
5. Big Data Technologies
6. Cloud Computing
JVM (Java Virtual Machine)
● Small engine thatactually runsthe Java program.
.classfile (bytecode) → converts into machine code.
● Takes
● Main role =Execution.
● Without JVM, Java programs cannot run.
JRE (Java Runtime Environment)
● The environment needed torunJava.
● JRE = JVM + required libraries/files.
● Users who only want to run apps install JRE.
JDK (Java Development Kit)
● Full package fordevelopers.
javac(compiler), debugger, etc.
● JDK = JRE + JVM + tools like
● Used to write, compile, and run Java programs.
JDK → for DEVELOPING
└── JRE → for RUNNING
└── JVM → for EXECUTING