JAVA COMPLETE REVISION NOTES
1. BASIC STRUCTURE
Java program contains classes and a main method. Execution starts in main().
2. DATA TYPES
Primitive: int, float, double, boolean, char, byte, short, long.
Non-primitive: String, arrays, classes, objects.
3. OPERATORS
Arithmetic, relational, logical, assignment, unary.
4. CONDITIONS
if-else, switch.
5. LOOPS
for, while, do-while, enhanced for.
6. ARRAYS
1D and 2D arrays.
7. METHODS
User-defined methods, return type, parameters, overloading.
8. OOP CONCEPTS
Class & Object: Blueprint + real entity.
Constructor: Special method to initialize objects.
Inheritance: One class acquiring properties of another.
Polymorphism: One name, many forms (overloading, overriding).
Encapsulation: Binding data using private + getter/setter.
Abstraction: Showing essential features and hiding details.
Abstract class: Can have abstract + normal methods.
Interface: Fully abstract blueprint; supports multiple inheritance.
9. STRINGS
length(), charAt(), equals(), compareTo(), substring(), toUpperCase().
10. EXCEPTION HANDLING
try, catch, finally. Common exceptions: Arithmetic, ArrayIndexOutOfBounds, NullPointer.
11. WRAPPER CLASSES
Integer, Double, Character.
12. ARRAYLIST
Dynamic array with add(), get(), remove().
13. DESIGN PATTERNS
Singleton: Only one object allowed.
Factory: Creates objects without exposing creation logic.
Observer: When one object changes, others get updated.
14. ABSTRACTION (DETAILED)
Abstraction means focusing on what an object does, not how it does it.
Example: Using a car – you use steering, but you don't see the engine details.
In Java:
- Abstract classes provide partial abstraction.
- Interfaces provide full abstraction.
15. GUI (SWING)
Common components:
JFrame – main window
JButton – button
JLabel – text label
JTextField – input field
ActionListener – handles events
Example:
JButton b = new JButton("Click");
[Link](b);
16. FILE HANDLING
File f = new File("[Link]");
17. ACCESS MODIFIERS
public, private, protected, default.