Table of Contents:
Preface xxi
Chapter 1: A Quick Tour 1
1.1 Getting Started 1
1.2 Variables 3
1.3 Comments in Code 6
1.4 Named Constants 7
1.5 Unicode Characters 8
1.6 Flow of Control 9
1.7 Classes and Objects 12
1.8 Methods and Parameters 15
1.9 Arrays 18
1.10 String Objects 21
1.11 Extending a Class 24
1.12 Interfaces 27
1.13 Generic Types 29
1.14 Exceptions 32
1.15 Annotations 35
1.16 Packages 36
1.17 The Java Platform 38
1.18 Other Topics Briefly Noted 39Chapter 2: Classes and Objects 41
2.1 A Simple Class 42
2.2 Fields 44
2.3 Access Control 47
2.4 Creating Objects 49
2.5 Construction and Initialization 50
2.6 Methods 56
2.7this
68
2.8 Overloading Methods 69
2.9 Importing Static Member Names 71
2.10 Themain
Method 73
2.11 Native Methods 74Chapter 3: Extending Classes 75
3.1 An Extended Class 76
3.2 Constructors in Extended Classes 80
3.3 Inheriting and Redefining Members 84
3.4 Type Compatibility and Conversion 90
3.5 Whatprotected
Really Means 93
3.6 Marking Methods and Classesfinal
96
3.7 Abstract Classes and Methods 97
3.8 TheObject
Class 99
3.9 Cloning Objects 101
3.10 Extending Classes: How and When 107
3.11 Designing a Class to Be Extended 108
3.12 Single Inheritance versus Multiple Inheritance 114Chapter 4: Interfaces 117
4.1 A Simple Interface Example 118
4.2 Interface Declarations 120
4.3 Extending Interfaces 122
4.4 Working with Interfaces 126
4.5 Marker Interfaces 130
4.6 When to Use Interfaces 131Chapter 5: Nested Classes and Interfaces 133
5.1 Static Nested Types 133
5.2 Inner Classes 136
5.3 Local Inner Classes 142
5.4 Anonymous Inner Classes 144
5.5 Inheriting Nested Types 146
5.6 Nesting in Interfaces 148
5.7 Implementation of Nested Types 149Chapter 6: Enumeration Types 151
6.1 A Simple Enum Example 151
6.2 Enum Declarations 152
6.3 Enum Constant Declarations 154
6.4java.lang.Enum
159
6.5 To Enum or Not 160Chapter 7: Tokens, Values, and Variables 161
7.1 Lexical Elements 161
7.2 Types and Literals 166
7.3 Variables 169
7.4 Array Variables 173
7.5 The Meanings of Names 178Chapter 8: Primitives as Types 183
8.1 Common Fields and Methods 184
8.2Void
187
8.3Boolean
187
8.4Number
188
8.5Character
192
8.6 Boxing Conversions 198Chapter 9: Operators and Expressions 201
9.1 Arithmetic Operations 201
9.2 General Operators 204
9.3 Expressions 214
9.4 Type Conversions 216
9.5 Operator Precedence and Associativity 221
9.6 Member Access 223Chapter 10: Control Flow 229
10.1 Statements and Blocks 229
10.2if-else
230
10.3switch
232
10.4while
anddo-while
235
10.5for
236
10.6 Labels 241
10.7break
241
10.8continue
244
10.9return
245
10.10 What, Nogoto
? 246Chapter 11: Generic Types 247
11.1 Generic Type Declarations 250
11.2 Working with Generic Types 256
11.3 Generic Methods and Constructors 260
11.4 Wildcard Capture 264
11.5 Under the Hood: Erasure and Raw Types 267
11.6 Finding the Right Method--Revisited 272
11.7 Class Extension and Generic Types 276Chapter 12: Exceptions and Assertions 279
12.1 Creating Exception Types 280
12.2throw
282
12.3 Thethrows
Clause 283
12.4try
,catch
, andfinally
286
12.5 Exception Chaining 291
12.6 Stack Traces 294
12.7 When to Use Exceptions 294
12.8 Assertions 296
12.9 When to Use Assertions 297
12.10 Turning Assertions On and Off 300
Reference demo_5
In stock 297 Items
Data sheet
- Compositions
- Viscose
- Styles
- Casual
- Properties
- Maxi Dress