else, 317–320
else if, 318–320
encapsulation, 82–85
benefits of, 83
how to include in code design, 83–84
problem of lack of, 85
two-minute drill, 153
enhanced for loops (for arrays), 338–340
entry point, 326–527
enums
in case statement, 326
declaration of class members, 60–65
equality (== and !=) operators for, 282–283
switch statements and, 324
two-minute drill, 73
equality (== and !=) operators
boxing and, 235
for enums, 282–283
equals() compared with, 524
overview, 280
for primitives, 280–281
for references variables, 281–282
equals(), 524–529
contract in Java does, 529
implementing, 526–528
not overriding, 525–526
Object class, 524–529
overriding, 524–525
public methods, 528
two-minute drill, 606–607
equalsIgnoreCase(), 422
Error class
compared with Exception, 363–364
in exception hierarchy, 354–355
error messages
"An exception occurs at runtime," 338
"Compilation fails," 338
errors
common exceptions and errors, 366–367, 370
scoping errors, 191–192
Exception class
compared with Error, 363–364
exception hierarchy and, 354–355
overview, 353–354
exception handling
common exceptions and errors, 366–367, 370
defining exceptions, 353–354
exception declaration and public interface, 359–364
exception hierarchy, 354–355
exception matching, 357–359
exercise creating an exception, 365–366
exercise propagating and catching an exception, 352–353
finally, 347–349
handling entire class hierarchy of exceptions, 356–357
JVM thrown exceptions, 367–368
overview, 344–345
programmatically thrown exceptions, 368–369
propagating uncaught exceptions, 350–352
rethrowing exceptions, 364–365
self test answers, 399–410
self test questions, 389–398
sources of exceptions, 367
try and catch, 345–347
two-minute drill, 387
exception matching, 357–359
"An exception occurs at runtime," 338
expression aspect, for statements, 339
expression rules, assertions, 373–374
extends, 120–121