Preface xv
Acknowledgments xvii
Chapter 1: Fundamental Programming Structures 1
1.1 Our First Program 1
1.2 Primitive Types 12
1.3 Variables 15
1.4 Arithmetic Operations 18
1.5 Strings 25
1.6 Input and Output 36
1.7 Control Flow 40
1.8 Arrays and Array Lists 48
1.9 Functional Decomposition 58
1.10 Exercises 60
Chapter 2: Object-Oriented Programming 63
2.1 Working with Objects 63
2.2 Implementing Classes 68
2.3 Object Construction 73
2.4 Records 78
2.5 Static Variables and Methods 81
2.6 Packages 85
2.7 Nested Classes 92
2.8 Documentation Comments 97
2.9 Exercises 102
Chapter 3: Interfaces and Lambda Expressions 105
3.1 Interfaces 106
3.2 Static, Default, and Private Methods 113
3.3 Examples of Interfaces 117
3.4 Lambda Expressions 121
3.5 Method and Constructor References 124
3.6 Processing Lambda Expressions 126
3.7 Lambda Expressions and Variable Scope 131
3.8 Higher-Order Functions 135
3.9 Local and Anonymous Classes 137
3.10 Exercises 139
Chapter 4: Inheritance and Reflection 141
4.1 Extending a Class 142
4.2 Inheritance Hierarchies 148
4.3 Object: The Cosmic Superclass 155
4.4 Enumerations 164
4.5 Pattern Matching 168
4.6 Runtime Type Information and Resources 174
4.7 Reflection 183
4.8 Exercises 192
Chapter 5: Exceptions, Assertions, and Logging 195
5.1 Exception Handling 195
5.2 Assertions 208
5.3 Logging 210<lãf