Object class
equals(), 524–529
hashCode(), 529–536
Java refresher, 2
methods, 523
object eligibility for garbage collection, 247
objects defined, 2
objects in heap memory, 174
thread-related methods, 690
toString(), 522–524
"object graph," serialization and, 445–449
object orientation
cohesion, 147, 149–150
constructor chaining, 128–129
constructor rules, 129–130
constructors, 126–128
coupling and cohesion, 147–149
default constructors, when created, 131–135
encapsulation, 82–85
HAS-A relationships, 92–94
inheritance, 86–90
interface implementation, 115–121
IS-A relationships, 90–91
object-oriented design, 93
overloaded constructors, 135–141
overloaded methods, 105–109
overridden methods, 99–105
polymorphism, 94–98, 109–111
reference variable casting, 112–115
return types, 122–126
self test answers, 164–172
self test questions, 158–163
statics, 141–147
two-minute drill, 153–155
object references
arrays of, 221
default values, 193
equality operators, 280
instance variables, 194–196
instanceof operator and, 283–285
local object references, 199–200
passing object reference variables, 203–204
ObjectInputStream, 444–445
ObjectOutputStream, 444–445
octal literals, 177
one-dimensional arrays
assigning, 222–223
constructing, 211–212
operators, 276–314
arithmetic, 286
assignment, 276–277
bitwise, 293
compound assignment, 277–278
conditional, 292–293
equality, 280–283
increment/decrement, 290–291
instanceof, 283–286
logical, 293, 296–298
operator precedence, 278
overview, 276
relational, 278–279
remainder (%), 287
self test answers, 307–314
self test questions, 301–306
short-circuit logical, 294–296
string concatenation, 287–289
two-minute drill, 299–303
OR ( | ) operator, 296–297
OR ( | | ) operator, short-circuit OR, 294–296
ordered collections, 540
outer classes
creating inner class from outside outer class, 640–642
creating inner class instance from outer class instance, 640–642
instantiating inner class from within, 640
referencing inner classes from, 639
overloaded constructors, 135–141
overloaded methods, 105–109
invoking, 107–109
legal overloads, 106
vs. overridden, 106, 111
polymorphism in, 109–111
rules for, 105–106
two-minute drill, 154
overloading, advanced
overloading combined with var-args, 243–244
overloading combined with widening and boxing, 242–243
overloading with boxing and var-args, 239–240
overloading with widening reference variables, 240–241
overview, 237–239
two-minute drill, 258
overridden methods, 99–105
equals(), 524–525
example, 99–101
hashCode(), 529–530
illegal, 110
legal and illegal examples of, 105
vs. overloaded, 106, 111
polymorphism in, 109–111
rules for overriding a method, 102–103
superclass versions of, 103–104
toString(), 522–524
two-minute drill, 154