Java Practice Handbook – Complete Notes & Exercises
TABLE OF CONTENTS
1. Introduction to Java
2. JVM, JRE, JDK
3. Java Syntax & Structure
4. Variables & Data Types
5. Operators
6. Control Flow (if, switch)
7. Loops
8. Arrays (1D, 2D)
9. Strings & StringBuilder
10. Methods & Overloading
11. Recursion
12. Object-Oriented Programming
13. Classes & Objects
14. Constructors
15. Encapsulation
16. Inheritance
17. Polymorphism
18. Abstraction
19. Interfaces
20. Packages
21. Exception Handling (Beginner)
22. File Handling (Beginner)
23. Mini Projects
24. Practice Problems (100+)
-------------------------------------------------------------
1. INTRODUCTION TO JAVA
Java is a high-level, object-oriented, platform-independent programming language.
Key features:
- Object-Oriented
- Secure
- Robust
- Compiled + Interpreted
- Platform Independent
2. JVM, JRE, JDK
- JVM: Runs Java bytecode.
- JRE: Contains JVM + libraries.
- JDK: Contains JRE + development tools.
3. Java Syntax Example
public class Main {
public static void main(String[] args) {
[Link]("Hello Java");
}
}
4. Variables & Data Types
Primitive: int, float, double, char, boolean, long, short, byte
Non‑primitive: String, Arrays, Classes
5. Operators
- Arithmetic (+ - * / %)
- Logical (&& || !)
- Comparison (== != > < >= <=)
- Assignment (= += -= *=)
6. Control Flow
if (condition) {}
switch(value) { case 1: break; }
7. Loops
for, while, do-while
8. Arrays
int[] arr = {1,2,3};
2D array → int[][] matrix
9. Strings
Immutable objects
StringBuilder → mutable
10. Methods
returnType name(parameters) {}
Overloading → same method name, different parameters
11. Recursion
Method calling itself
12. What is OOP?
- Encapsulation
- Inheritance
- Polymorphism
- Abstraction
13. Classes & Objects
Classes = blueprint
Objects = real instances
14. Constructors
Same name as class, no return type
15. Encapsulation
Private variables + getters/setters
16. Inheritance
class A {}
class B extends A {}
17. Polymorphism
Compile‑time: Method Overloading
Run‑time: Method Overriding
18. Abstraction
abstract classes
interfaces
19. Interfaces
Java's multiple inheritance system
20. Packages
package myPackage;
21. Exception Handling (Basics)
try, catch, finally
22. File Handling
FileReader, FileWriter (beginner level)
23. Mini Projects
- ATM System
- Quiz App
- Student Manager
- Billing Software
24. Practice Problems (Sample)
1. Reverse a number
2. Check palindrome
3. Largest in array
4. Count vowels in string
5. Fibonacci recursion
6. Class-based Employee data
7. Inheritance: Shape class
8. Interface implementation
9. ATM simulation
10. File read/write basic