Program is a set of objects that act & interact like real-world things.
2
New cards
Object Contains
Data (fields) + methods (actions).
3
New cards
Class
Blueprint for objects, objects share the same methods, can have different data values.
4
New cards
Main program
Class with a main() method (entry point) = public static void main(String[] args).
5
New cards
Benefits of OOP
Readable, Maintainable, Reusable, Team-friendly - divide work by class; Fewer errors.
6
New cards
Encapsulation
Bundles data + methods into a class; use private for data (inside the class access only - hidden), public for access → protects integrity & modification.
7
New cards
Inheritance
One class (subclass/child) can reuse and extend another (superclass/parent). Subclass inherits fields + methods from the superclass automatically; can also add new features or override existing methods.
8
New cards
Polymorphism
Same method or object behaves differently depending on its type. Achieved through method overriding — subclass changes how a superclass method works.
9
New cards
Abstraction
Show essential features (what obj does not how), hides details; use abstract classes/interfaces → simpler, modular design.
10
New cards
Objects
Share structure/methods, but have their own data.
11
New cards
Java Origin
Created by James Gosling & team, 1991, Sun Microsystems → Oracle.
12
New cards
Java Goal
Run programs on different processors.
13
New cards
Java Bytecode
Intermediate form compiled from programs; runs on the Java Virtual Machine (JVM) → portable across all systems.
14
New cards
Java Applets
Small programs for browsers or applet viewer; graphical interface.
15
New cards
System.out
An object that sends output to the screen.
16
New cards
println()
A method that prints text to the screen.
17
New cards
Method call syntax
object.methodName(arguments); where object = who performs the action, methodName = what action to perform, arguments = info sent to the method (optional).
18
New cards
Variable Declaration Syntax
type variableName;
19
New cards
Assignment
Assigns a value to a variable using =; for example, ans = 2 + 2; // ans now holds 4.