Java Complete Guide (Full Colorful Edition)
JAVA COMPLETE GUIDE
1. Java Basics & OOP Overview
- Java is object-oriented and platform independent.
- Bytecode executed by JVM.
- Example program: class Hello { public static void main(String[] args){ [Link]("Hello Java"); } }
- OOP Principles: Encapsulation, Abstraction, Inheritance, Polymorphism.
2. Data Types & Variables
- Primitive: byte, short, int, long, float, double, char, boolean.
- Example: int age=25; double price=9.99;
- Literals and scope explained.
3. Operators
- Arithmetic, relational, logical, assignment.
- Example: int x=9/4; double d=9.0/4;
4. Type Conversion & Casting
- Widening: int→double.
- Narrowing: double→int.
- Expression promotion rules.
5. Control Structures
- if-else, switch, loops.
- break, continue.
6. Arrays
- 1D, 2D arrays, reference behavior.
- Example: int[] a={10,20,30}; int[] b=a;
7. Classes & Objects
- Class template, methods, attributes.
8. Constructors
- Default, parameterized, copy.
9. Method Overloading
- Same name, different parameters.
10. LocalDate API
- now(), plusDays(), between().
--- EXPANDED EXERCISES ---
Loops & Math:
1. Print first 20 squares.
2. Sum of first 20 squares.
3. Print even numbers.
Control Structures:
4. Print star pattern.
5. Count digits.
6. Palindrome.
7. Prime numbers.
Type Conversion:
8. Fix byte multiplication.
9. Cast double→int.
10. Wrapping behavior.
Arrays:
11. Reference behavior demo.
12. Find maximum.
13. Reverse array.
Classes & Objects:
14. Length addition.
15. Date +1 day.
16. Student grading.
Constructors:
17. Copy constructor.
18. Swapper.
Overloading:
19. Overloaded sum.
20. Promotion demo.