Java for Beginners
Learn to Code from Scratch
Table of Contents
Chapter 1: Introduction to Java
1
Why Java? History and Use Cases
1
Installing the JDK and Setting Up Your IDE
3
Writing Your First Java Program
6
Compiling and Running Java Code
9
Chapter 2: Basic Syntax and Structure
11
Variables and Data Types
11
Operators and Expressions
14
Control Flow: if, else, switch
18
Looping Constructs: for, while, do-while
22
Chapter 3: Working with Methods
26
Defining and Calling Methods
26
Parameters and Return Values
30
Method Overloading
33
The
main
Method Explained
36
Chapter 4: Understanding Objects and Classes
39
Defining Classes and Creating Objects
39
Fields and Methods in Classes
43
Constructors and
this
Keyword
46
Introduction to Encapsulation
49
Chapter 5: Data Structures Arrays and Strings
53
One-Dimensional and Multidimensional Arrays
53
Common Array Algorithms
57
Working with Strings and StringBuilder
64
String Comparison and Manipulation
67
Chapter 6: Encapsulation and Access Control
70
Getters and Setters
70
Access Modifiers: public, private, protected
73
Packages and Import Statements
77
Chapter 7: Inheritance and Polymorphism
80
Understanding
extends
and
super
80
Overriding Methods
85
Using
instanceof
and Type Casting
88
Dynamic Method Dispatch
91
Chapter 8: Abstract Classes and Interfaces
95
Abstract Methods and Classes
95
Implementing Interfaces
99
Interface vs Abstract Class
104
Functional Interfaces and Lambda Basics
108
Chapter 9: Exception Handling
110
try, catch, finally
110
Throwing and Catching Exceptions
114
Creating Custom Exceptions
117
Checked vs Unchecked Exceptions
120
Chapter 10: Java Collections Framework
123
List, Set, and Map Interfaces
123
ArrayList, LinkedList, HashSet, TreeSet, HashMap
126
Iterators and Enhanced for Loop
133
Sorting and Searching Collections
136
Chapter 11: Working with Files and I/O
142
Reading and Writing Files (java.io, java.nio)
142
BufferedReader and BufferedWriter
146
Serialization and Deserialization
150
File Paths and Directories
153
Chapter 12: Java 8 and Beyond: Modern Features
158
Lambda Expressions in Depth
158
Stream API Basics and Pipelines
162
Method References and Optional
166
Date and Time API (
java.time
)
171
Chapter 13: Inner and Nested Classes
175
Member and Static Nested Classes
175
Anonymous Inner Classes
178
Local Inner Classes and Use Cases
181
Related Books
Introduction
Java Syntax
From Beginner to Expert
Introduction
Java Date and Time
A Systematic Approach
Introduction
Java Object-Oriented Design
Principles, Patterns, and Practices
Introduction
Java IO and NIO
Guide for Beginner to Advanced Programmers
Introduction
Java Collections
From Fundamentals to Advanced Applications
Introduction
Java Regex
From Basics to Advanced
Introduction
Java Functional Programming
From Lambdas to Reactive Streams
Introduction
Java Streams
From Fundamentals to Advanced Data Processing
More Books on Java