INTRODUCTION TO JAVA & OOP CONCEPTS
Object Oriented Programming (OOP):
OOP is a programming paradigm based on objects which contain data and methods.
Main principles: Encapsulation, Abstraction, Inheritance, Polymorphism.
History of Java:
Java was developed by James Gosling at Sun Microsystems in 1995.
It is platform independent due to JVM.
Java Buzzwords:
Simple, Object-Oriented, Platform Independent, Secure, Robust, Multithreaded, Portable.
JVM Architecture:
Class Loader, Memory Areas, Execution Engine, Native Method Interface.
Data Types:
Primitive: int, float, double, char, boolean.
Non-Primitive: String, Array, Class.
Variables:
Local, Instance, Static variables.
Scope and lifetime depend on variable type.
Arrays:
Used to store multiple values of same data type.
Operators:
Arithmetic, Relational, Logical, Assignment, Unary.
Control Statements:
if, if-else, switch, for, while, do-while.
Constructors:
Used to initialize objects. Same name as class.
Methods:
Block of code to perform a task.
Static Members:
Static variable, static method, static block.
String and StringBuffer:
String is immutable, StringBuffer is mutable.
Inheritance:
Acquiring properties of parent class.
Types: Single, Multilevel, Hierarchical.
Keywords:
this – refers current object.
super – refers parent class object.
Method Overloading:
Same method name with different parameters.