INTRODUCTION TO JAVA – COMPLETE NOTES
Creation of Java
Java was developed by James Gosling at Sun Microsystems in 1991. Initially called Oak, it was
renamed Java in 1995. Java was designed to be simple, secure, portable, and object-oriented.
Difference between Java and C
Java is object-oriented, platform-independent, secure, and uses automatic memory management,
whereas C is procedural, platform-dependent, and uses manual memory management.
Java Magic
Java source code is compiled into bytecode, which runs on the JVM. This enables Write Once Run
Anywhere.
JVM
Java Virtual Machine loads, verifies, and executes bytecode. Each OS has its own JVM.
JRE
Java Runtime Environment provides libraries and JVM to run Java programs.
JIT Compiler
Just-In-Time compiler improves performance by converting bytecode to machine code at runtime.
JDK
Java Development Kit includes JRE, compiler, and development tools.
Java Features
Simple, Object-Oriented, Secure, Robust, Portable, Multithreaded, High Performance.
OOP Principles
Encapsulation, Inheritance, Polymorphism, Abstraction.
Data Types
Primitive: int, float, double, char, boolean, etc.
Non-Primitive: Arrays, Classes, Objects, Strings.
Variables
Local, Instance, Static variables.
Dynamic Initialization
Assigning values at runtime using expressions.
Type Conversion & Casting
Implicit (Widening) and Explicit (Narrowing). Incompatible types cause errors.
Operators
Arithmetic, Relational, Logical, Assignment, Increment & Decrement.
Arrays
One-dimensional and Multi-dimensional arrays.
Control Statements
Decision, Looping, ForEach loop, Jump statements (break, continue, return).
Classes & Objects
Class is a blueprint. Object is an instance of a class.
Constructors
Special methods used to initialize objects. Types: Default and Parameterized.
This Keyword
Refers to the current object.
Garbage Collection
Automatic memory management by JVM.
Finalize Method
Called before object destruction for cleanup tasks.
END OF NOTES