SafariNode SeqNo pageNo numPages Chapter ChapterTitle Section Title hfjava2-PREFACE-3 1 i 5 Preface Preface What they're saying What they're saying about Head First hfjava2-PREFACE-1 2 xi 1 Preface Preface Copyright Copyright hfjava2-DEDICATION 3 xii 5 Preface Preface Dedication Dedication hfjava2-PREFACE-2 4 xxi 1 Preface Preface Intro Intro hfjava2-PREFACE-2 4.22 xxii 1 Preface Preface Intro Who is this book for? hfjava2-PREFACE-2 4.23 xxiii 1 Preface Preface Intro We know what you're thinking hfjava2-PREFACE-2 4.24 xxiv 1 Preface Preface Intro "We think of a ""Head First Java"" reader as a learner" hfjava2-PREFACE-2 4.25 xxv 1 Preface Preface Intro Metacognition: thinking about thinking hfjava2-PREFACE-2 4.26 xxvi 1 Preface Preface Intro Here's what we did hfjava2-PREFACE-2 4.27 xxvii 1 Preface Preface Intro Here's what YOU can do to bend your brain into submission hfjava2-PREFACE-2 4.28 xxviii 1 Preface Preface Intro What you need for this book hfjava2-PREFACE-2 4.29 xxix 1 Preface Preface Intro Last minute things you need to know hfjava2-PREFACE-2 4.3 xxx 3 Preface Preface Intro Acknowledgments hfjava2-CHP-1 5 1 1 Chapter 1 Breaking the Surface Chapter 1 Breaking the Surface hfjava2-CHP-1-SECT-1 6 2 1 Chapter 1 Breaking the Surface Section 1.1 The Way Java Works hfjava2-CHP-1-SECT-2 7 3 1 Chapter 1 Breaking the Surface Section 1.2 What you'll do in Java hfjava2-CHP-1-SECT-3 8 4 1 Chapter 1 Breaking the Surface Section 1.3 A very brief history of Java hfjava2-CHP-1-SECT-4 9 5 1 Chapter 1 Breaking the Surface Section 1.4 Sharpen your pencil hfjava2-CHP-1-SECT-5 10 6 1 Chapter 1 Breaking the Surface Section 1.5 Sharpen your pencil answers hfjava2-CHP-1-SECT-6 11 7 1 Chapter 1 Breaking the Surface Section 1.6 Code structure in Java hfjava2-CHP-1-SECT-7 12 8 1 Chapter 1 Breaking the Surface Section 1.7 Anatomy of a class hfjava2-CHP-1-SECT-8 13 9 1 Chapter 1 Breaking the Surface Section 1.8 Writing a class with a main hfjava2-CHP-1-SECT-9 14 10 1 Chapter 1 Breaking the Surface Section 1.9 What can you say in the main method? hfjava2-CHP-1-SECT-10 15 11 1 Chapter 1 Breaking the Surface Section 1.10 Looping and looping and... hfjava2-CHP-1-SECT-11 16 12 1 Chapter 1 Breaking the Surface Section 1.11 there are no Dumb Questions hfjava2-CHP-1-SECT-12 17 13 1 Chapter 1 Breaking the Surface Section 1.12 Conditional branching hfjava2-CHP-1-SECT-13 18 14 1 Chapter 1 Breaking the Surface Section 1.13 Coding a Serious Business Application hfjava2-CHP-1-SECT-14 19 15 2 Chapter 1 Breaking the Surface Section 1.14 Monday morning at Bob's hfjava2-CHP-1-SECT-15 20 17 1 Chapter 1 Breaking the Surface Section 1.15 Phrase-O-Matic hfjava2-CHP-1-SECT-16 21 18 2 Chapter 1 Breaking the Surface Section 1.16 Fireside Chats hfjava2-CHP-1-SECT-17 22 20 1 Chapter 1 Breaking the Surface Section 1.17 Exercise: Code Magnets hfjava2-CHP-1-SECT-18 23 21 1 Chapter 1 Breaking the Surface Section 1.18 Exercise: BE The compiler hfjava2-CHP-1-SECT-19 24 22 1 Chapter 1 Breaking the Surface Section 1.19 JavaCross 7.0 hfjava2-CHP-1-SECT-20 25 23 1 Chapter 1 Breaking the Surface Section 1.20 Mixed Messages hfjava2-CHP-1-SECT-21 26 24 1 Chapter 1 Breaking the Surface Section 1.21 Pool Puzzle hfjava2-CHP-1-SECT-22 27 25 2 Chapter 1 Breaking the Surface Section 1.22 Exercise Solutins: Code Magnets: hfjava2-CHP-2 28 27 1 Chapter 2 A Trip to Objectville Chapter 2 A Trip to Objectville hfjava2-CHP-2-SECT-1 29 28 5 Chapter 2 A Trip to Objectville Section 2.1 Chair Wars hfjava2-CHP-2-SECT-2 30 33 3 Chapter 2 A Trip to Objectville Section 2.2 Brain Power hfjava2-CHP-2-SECT-3 31 36 1 Chapter 2 A Trip to Objectville Section 2.3 Making your first object hfjava2-CHP-2-SECT-4 32 37 1 Chapter 2 A Trip to Objectville Section 2.4 Making and testing Movie objects hfjava2-CHP-2-SECT-5 33 38 2 Chapter 2 A Trip to Objectville Section 2.5 Quick! Get out of main! hfjava2-CHP-2-SECT-6 34 40 5 Chapter 2 A Trip to Objectville Section 2.6 Running the Guessing Game hfjava2-CHP-2-SECT-7 35 45 4 Chapter 2 A Trip to Objectville Section 2.7 Who am I? hfjava2-CHP-3 36 49 1 Chapter 3 Know Your Variables Chapter 3 Know Your Variables hfjava2-CHP-3-SECT-1 37 50 1 Chapter 3 Know Your Variables Section 3.1 Declaring a variable hfjava2-CHP-3-SECT-2 38 51 1 Chapter 3 Know Your Variables Section 3.2 ""I'd like a double mocha, no, make it an int."" hfjava2-CHP-3-SECT-3 39 52 1 Chapter 3 Know Your Variables Section 3.3 You really don't want to spill that... hfjava2-CHP-3-SECT-4 40 53a 0 Chapter 3 Know Your Variables Section 3.4 Back away from that keyword! hfjava2-CHP-3-SECT-5 41 53b 1 Chapter 3 Know Your Variables Section 3.5 This table reserved. hfjava2-CHP-3-SECT-6 42 54 1 Chapter 3 Know Your Variables Section 3.6 Controlling your Dog object hfjava2-CHP-3-SECT-7 43 55 1 Chapter 3 Know Your Variables Section 3.7 An object reference is just another variable value. hfjava2-CHP-3-SECT-8 44 56a 0 Chapter 3 Know Your Variables Section 3.8 There are no Dumb Question hfjava2-CHP-3-SECT-9 45 56b 1 Chapter 3 Know Your Variables Section 3.9 Java Exposed hfjava2-CHP-3-SECT-10 46 57a 0 Chapter 3 Know Your Variables Section 3.10 Life on the garbage-collectible heap hfjava2-CHP-3-SECT-11 47 57b 2 Chapter 3 Know Your Variables Section 3.11 Life and death on the heap hfjava2-CHP-3-SECT-12 48 59a 0 Chapter 3 Know Your Variables Section 3.12 An array is like a tray of cups hfjava2-CHP-3-SECT-13 49 59b 1 Chapter 3 Know Your Variables Section 3.13 Arrays are objects too hfjava2-CHP-3-SECT-14 50 60 1 Chapter 3 Know Your Variables Section 3.14 Make an array of Dogs hfjava2-CHP-3-SECT-15 51 61 1 Chapter 3 Know Your Variables Section 3.15 Control your Dog hfjava2-CHP-3-SECT-16 52 62 1 Chapter 3 Know Your Variables Section 3.16 A Dog example hfjava2-CHP-3-SECT-17 53 63 1 Chapter 3 Know Your Variables Section 3.17 Exercise: BE the compiler hfjava2-CHP-3-SECT-18 54 64 1 Chapter 3 Know Your Variables Section 3.18 Exercise: Code Magnets hfjava2-CHP-3-SECT-19 55 65 1 Chapter 3 Know Your Variables Section 3.19 Pool Puzzle hfjava2-CHP-3-SECT-20 56 66 1 Chapter 3 Know Your Variables Section 3.20 A Heap o' Trouble hfjava2-CHP-3-SECT-21 57 67 1 Chapter 3 Know Your Variables Section 3.21 Five-Minute Mystery hfjava2-CHP-3-SECT-22 58 68 1 Chapter 3 Know Your Variables Section 3.22 Exercise Solutions: Code Magnets hfjava2-CHP-3-SECT-23 59 69 2 Chapter 3 Know Your Variables Section 3.23 Puzzle Solutions hfjava2-CHP-4 60 71 1 Chapter 4 How Objects Behave Chapter 4 How Objects Behave hfjava2-CHP-4-SECT-1 61 72 1 Chapter 4 How Objects Behave Section 4.1 Remember: a class describes what an object knows and what an object does hfjava2-CHP-4-SECT-2 62 73 1 Chapter 4 How Objects Behave Section 4.2 The size affects the bark hfjava2-CHP-4-SECT-3 63 74 1 Chapter 4 How Objects Behave Section 4.3 You can send things to a method hfjava2-CHP-4-SECT-4 64 75 1 Chapter 4 How Objects Behave Section 4.4 You can get things back from a method. hfjava2-CHP-4-SECT-5 65 76 1 Chapter 4 How Objects Behave Section 4.5 You can send more than one thing to a method hfjava2-CHP-4-SECT-6 66 77 1 Chapter 4 How Objects Behave Section 4.6 there are no Dumb Questions hfjava2-CHP-4-SECT-7 67 78 1 Chapter 4 How Objects Behave Section 4.7 Reminder: Java cares about type! hfjava2-CHP-4-SECT-8 68 79 1 Chapter 4 How Objects Behave Section 4.8 Cool things you can do with parameters and return types hfjava2-CHP-4-SECT-9 69 80 2 Chapter 4 How Objects Behave Section 4.9 Encapsulation hfjava2-CHP-4-SECT-10 70 82 1 Chapter 4 How Objects Behave Section 4.10 Encapsulating the GoodDog class hfjava2-CHP-4-SECT-11 71 83 1 Chapter 4 How Objects Behave Section 4.11 How do objects in an array behave? hfjava2-CHP-4-SECT-12 72 84 1 Chapter 4 How Objects Behave Section 4.12 Declaring and initializing instance variables hfjava2-CHP-4-SECT-13 73 85a 0 Chapter 4 How Objects Behave Section 4.13 The difference between instance and local variables hfjava2-CHP-4-SECT-14 74 85b 1 Chapter 4 How Objects Behave Section 4.14 there are no Dumb Questions hfjava2-CHP-4-SECT-15 75 86 2 Chapter 4 How Objects Behave Section 4.15 Comparing variables (primitives or references) hfjava2-CHP-4-SECT-16 76 88 1 Chapter 4 How Objects Behave Section 4.16 Exercise: BE the compiler hfjava2-CHP-4-SECT-17 77 89 1 Chapter 4 How Objects Behave Section 4.17 Who am I? hfjava2-CHP-4-SECT-18 78 90 1 Chapter 4 How Objects Behave Section 4.18 Mixed Messages hfjava2-CHP-4-SECT-19 79 91 1 Chapter 4 How Objects Behave Section 4.19 Pool Puzzle hfjava2-CHP-4-SECT-20 80 92 2 Chapter 4 How Objects Behave Section 4.20 Five Minute Mystery hfjava2-CHP-4-SECT-21 81 94 1 Chapter 4 How Objects Behave Section 4.21 Puzzle Solutions hfjava2-CHP-5 82 95 1 Chapter 5 Extra-Strength Methods Chapter 5 Extra-Strength Methods hfjava2-CHP-5-SECT-1 83 96 1 Chapter 5 Extra-Strength Methods Section 5.1 Let's build a Battleship-style game: "Sink a Dot Com" hfjava2-CHP-5-SECT-2 84 97 1 Chapter 5 Extra-Strength Methods Section 5.2 "First, a high-level design" hfjava2-CHP-5-SECT-3 85 98 1 Chapter 5 Extra-Strength Methods Section 5.3 The "Simple Dot Com Game" a gentler introduction hfjava2-CHP-5-SECT-4 86 99a 0 Chapter 5 Extra-Strength Methods Section 5.4 Developing a Class hfjava2-CHP-5-SECT-5 87 99b 4 Chapter 5 Extra-Strength Methods Section 5.5 BRAIN POWER hfjava2-CHP-5-SECT-6 88 103 3 Chapter 5 Extra-Strength Methods Section 5.6 There are no Dumb Questions hfjava2-CHP-5-SECT-7 89 106 4 Chapter 5 Extra-Strength Methods Section 5.7 There are no Dumb Questions hfjava2-CHP-5-SECT-7 89.2 110 4 Chapter 5 Extra-Strength Methods Section 5.7 The game's main() method hfjava2-CHP-5-SECT-7 89.5 114 2 Chapter 5 Extra-Strength Methods Section 5.7 More about for loops hfjava2-CHP-5-SECT-7 89.6 116 1 Chapter 5 Extra-Strength Methods Section 5.7 The enhanced for loop hfjava2-CHP-5-SECT-7 89.7 117 1 Chapter 5 Extra-Strength Methods Section 5.7 Casting primitives hfjava2-CHP-5-SECT-8 90 118 1 Chapter 5 Extra-Strength Methods Section 5.8 Exercise: BE the JVM hfjava2-CHP-5-SECT-9 91 119 1 Chapter 5 Extra-Strength Methods Section 5.9 Exercise: Code Magnets hfjava2-CHP-5-SECT-10 92 120 2 Chapter 5 Extra-Strength Methods Section 5.10 Java Cross hfjava2-CHP-5-SECT-11 93 122 3 Chapter 5 Extra-Strength Methods Section 5.11 Exercise Solutions hfjava2-CHP-6 94 125 1 Chapter 6 Using the Java Library Chapter 6 Using the Java Library hfjava2-CHP-6-SECT-1 95 126 1 Chapter 6 Using the Java Library Section 6.1 "In our last chapter, we left you with the cliff-hanger. A bug." hfjava2-CHP-6-SECT-2 96 127 1 Chapter 6 Using the Java Library Section 6.2 So what happened? hfjava2-CHP-6-SECT-3 97 128 1 Chapter 6 Using the Java Library Section 6.3 How do we fix it? hfjava2-CHP-6-SECT-4 98 129a 0 Chapter 6 Using the Java Library Section 6.4 Option one is too clunky hfjava2-CHP-6-SECT-5 99 129b 3 Chapter 6 Using the Java Library Section 6.5 "Option two is a little better, but still pretty clunky" hfjava2-CHP-6-SECT-6 100 132 1 Chapter 6 Using the Java Library Section 6.6 Wake up and smell the library hfjava2-CHP-6-SECT-7 101 133 2 Chapter 6 Using the Java Library Section 6.7 Some things you can do with ArrayList hfjava2-CHP-6-SECT-8 102 135a 0 Chapter 6 Using the Java Library Section 6.8 there are no Dumb Questions hfjava2-CHP-6-SECT-9 103 135b 1 Chapter 6 Using the Java Library Section 6.9 Java Exposed hfjava2-CHP-6-SECT-10 104 136 1 Chapter 6 Using the Java Library Section 6.10 Comparing ArrayList to a regular array hfjava2-CHP-6-SECT-11 105 137 1 Chapter 6 Using the Java Library Section 6.11 Comparing ArrayList to a regular array hfjava2-CHP-6-SECT-12 106 138 1 Chapter 6 Using the Java Library Section 6.12 Let's fix the DotCom code. hfjava2-CHP-6-SECT-13 107 139 1 Chapter 6 Using the Java Library Section 6.13 New and improved DotCom class hfjava2-CHP-6-SECT-14 108 140 1 Chapter 6 Using the Java Library Section 6.14 Let's build the REAL game: "Sink a Dot Com" hfjava2-CHP-6-SECT-15 109 141 1 Chapter 6 Using the Java Library Section 6.15 What needs to change? hfjava2-CHP-6-SECT-16 110 142 2 Chapter 6 Using the Java Library Section 6.16 Who does what in the DotComBust game (and when) hfjava2-CHP-6-SECT-17 111 144 6 Chapter 6 Using the Java Library Section 6.17 Prep code for the real DotComBust class hfjava2-CHP-6-SECT-18 112 150 1 Chapter 6 Using the Java Library Section 6.18 The final version of the Dotcom class hfjava2-CHP-6-SECT-19 113 151 1 Chapter 6 Using the Java Library Section 6.19 Super Powerful Boolean Expressions hfjava2-CHP-6-SECT-20 114 152 1 Chapter 6 Using the Java Library Section 6.20 Ready-bake Code hfjava2-CHP-6-SECT-21 115 153 1 Chapter 6 Using the Java Library Section 6.21 Ready-bake Code hfjava2-CHP-6-SECT-22 116 154 1 Chapter 6 Using the Java Library Section 6.22 Using the Library (the Java API) hfjava2-CHP-6-SECT-23 117 155a 0 Chapter 6 Using the Java Library Section 6.23 You have to know the full name of the class you want to use in your code. hfjava2-CHP-6-SECT-24 118 155b 2 Chapter 6 Using the Java Library Section 6.24 there are no Dumb Questions hfjava2-CHP-6-SECT-25 119 157 1 Chapter 6 Using the Java Library Section 6.25 there are no Dumb Questions hfjava2-CHP-6-SECT-26 120 158 3 Chapter 6 Using the Java Library Section 6.26 How to play with the API hfjava2-CHP-6-SECT-27 121 161 1 Chapter 6 Using the Java Library Section 6.27 Code Magnets hfjava2-CHP-6-SECT-28 122 162 1 Chapter 6 Using the Java Library Section 6.28 JavaCross 7.0 hfjava2-CHP-6-SECT-29 123 163 1 Chapter 6 Using the Java Library Section 6.29 Exercise Solutions hfjava2-CHP-6-SECT-30 124 164 1 Chapter 6 Using the Java Library Section 6.30 JavaCross answers hfjava2-CHP-7 125 165 1 Chapter 7 Better Living in Objectville Chapter 7 Better Living in Objectville hfjava2-CHP-7-SECT-1 126 166 1 Chapter 7 Better Living in Objectville Section 7.1 Chair Wars Revisited... hfjava2-CHP-7-SECT-2 126.9 167a 1 Chapter 7 Better Living in Objectville Section 7.2 What about the amoeba rotate()? hfjava2-CHP-7-SECT-2 127.67 167b 1 Chapter 7 Better Living in Objectville Section 7.2 BRAIN POWER hfjava2-CHP-7-SECT-2 127.68 168 1 Chapter 7 Better Living in Objectville Section 7.2 Understanding Inheritance hfjava2-CHP-7-SECT-2 127.69 169 1 Chapter 7 Better Living in Objectville Section 7.2 An inheritance example: hfjava2-CHP-7-SECT-2 127.7 170 1 Chapter 7 Better Living in Objectville Section 7.2 Let's design the inheritance tree for an Animal simulation program (1) hfjava2-CHP-7-SECT-2 127.71 171 1 Chapter 7 Better Living in Objectville Section 7.2 Using inheritance to avoid duplicating code in subclasses (2) hfjava2-CHP-7-SECT-2 127.72 172 1 Chapter 7 Better Living in Objectville Section 7.2 Do all animals eat the same way? (3) hfjava2-CHP-7-SECT-2 127.73 173 1 Chapter 7 Better Living in Objectville Section 7.2 Looking for more inheritance opportunities (4) hfjava2-CHP-7-SECT-2 127.74 174 1 Chapter 7 Better Living in Objectville Section 7.2 Finish the class hierarchy (5) hfjava2-CHP-7-SECT-2 127.75 175 1 Chapter 7 Better Living in Objectville Section 7.2 Which method is called? hfjava2-CHP-7-SECT-3 127.9 176a 1 Chapter 7 Better Living in Objectville Section 7.3 Designing an Inheritance Tree hfjava2-CHP-7-SECT-3 128 176b 1 Chapter 7 Better Living in Objectville Section 7.3 there are no Dumb Questions hfjava2-CHP-7-SECT-3 128.07 177 1 Chapter 7 Better Living in Objectville Section 7.3 Using IS-A and HAS-A hfjava2-CHP-7-SECT-3 128.08 178 1 Chapter 7 Better Living in Objectville Section 7.3 "But wait! There's more! If class B extends class A, class B IS-A class A." hfjava2-CHP-7-SECT-3 128.09 179 1 Chapter 7 Better Living in Objectville Section 7.3 How do you know if you've got your inheritance right? hfjava2-CHP-7-SECT-4 129 180a 1 Chapter 7 Better Living in Objectville Section 7.4 there are no Dumb Questions hfjava2-CHP-7-SECT-4 129.01 180b 1 Chapter 7 Better Living in Objectville Section 7.4 "Who gets the Porsche, and who gets the porcelain?" hfjava2-CHP-7-SECT-4 129.81 181 1 Chapter 7 Better Living in Objectville Section 7.4 "When designing with inheritance, are using using or abusing?" hfjava2-CHP-7-SECT-4 129.82 182 1 Chapter 7 Better Living in Objectville Section 7.4 So what does all this inheritance really buy you? hfjava2-CHP-7-SECT-4 129.83 183 1 Chapter 7 Better Living in Objectville Section 7.4 And I care becauseā hfjava2-CHP-7-SECT-4 129.84 184 2 Chapter 7 Better Living in Objectville Section 7.4 To see how polymorphism worksā hfjava2-CHP-7-SECT-4 129.86 186 1 Chapter 7 Better Living in Objectville Section 7.4 "With polymorphism, the reference type can be a superclass of the actual object type" hfjava2-CHP-7-SECT-4 129.87 187 1 Chapter 7 Better Living in Objectville Section 7.4 You can have polymorphic arguments and return types. hfjava2-CHP-7-SECT-5 129.88 188a 1 Chapter 7 Better Living in Objectville Section 7.5 "Now I get it! With polymorphism, you can write code that doesn't have to changeā" hfjava2-CHP-7-SECT-5 130 188b 1 Chapter 7 Better Living in Objectville Section 7.5 brain power hfjava2-CHP-7-SECT-6 131 189 3 Chapter 7 Better Living in Objectville Section 7.6 there are no Dumb Questions hfjava2-CHP-7-SECT-7 132 192 1 Chapter 7 Better Living in Objectville Section 7.7 Exercise: Mixed Messages hfjava2-CHP-7-SECT-8 133 193 2 Chapter 7 Better Living in Objectville Section 7.8 Exercise BE the Compiler hfjava2-CHP-7-SECT-9 134 195 2 Chapter 7 Better Living in Objectville Section 7.9 Exercise Solutions: BE the Compiler hfjava2-CHP-8 135 197 1 Chapter 8 Serious Polymorphism Chapter 8 Serious Polymorphism hfjava2-CHP-8-SECT-1 136 198 2 Chapter 8 Serious Polymorphism Section 8.1 Did we forget about something when we designed this? hfjava2-CHP-8-SECT-1 136.1 200 1 Chapter 8 Serious Polymorphism Section 8.1 What does a new animal object look like hfjava2-CHP-8-SECT-1 136.2 201 1 Chapter 8 Serious Polymorphism Section 8.1 The compiler won't let you instantiate an abstract class hfjava2-CHP-8-SECT-2 137.01 202a 1 Chapter 8 Serious Polymorphism Section 8.2 Abstract vs. Concrete hfjava2-CHP-8-SECT-2 137.02 202b 1 Chapter 8 Serious Polymorphism Section 8.2 BRAIN POWER hfjava2-CHP-8-SECT-2 137.03 203 1 Chapter 8 Serious Polymorphism Section 8.2 Abstract methods hfjava2-CHP-8-SECT-2 137.04 204 1 Chapter 8 Serious Polymorphism Section 8.2 You MUST implement all abstract methods hfjava2-CHP-8-SECT-2 137.05 205 1 Chapter 8 Serious Polymorphism Section 8.2 Abstract vs. Concrete Classes hfjava2-CHP-8-SECT-2 137.06 206 1 Chapter 8 Serious Polymorphism Section 8.2 Polymorphism in action hfjava2-CHP-8-SECT-2 137.07 207 1 Chapter 8 Serious Polymorphism Section 8.2 "Uh-oh, now we need to keep Cats, too." hfjava2-CHP-8-SECT-2 137.08 208 1 Chapter 8 Serious Polymorphism Section 8.2 What about non-Animals? Why not make a class generic enough to take anything? hfjava2-CHP-8-SECT-2 137.09 209 1 Chapter 8 Serious Polymorphism Section 8.2 So what's in this ultra-super-megaclass Object? hfjava2-CHP-8-SECT-2 137.1 210 1 Chapter 8 Serious Polymorphism Section 8.2 There are no dumb questions (about class Object) hfjava2-CHP-8-SECT-2 137.11 211 1 Chapter 8 Serious Polymorphism Section 8.2 Using polymorphic references of type Object has a priceā hfjava2-CHP-8-SECT-2 137.12 212 1 Chapter 8 Serious Polymorphism Section 8.2 What a Dog won't act like a Dog hfjava2-CHP-8-SECT-2 137.13 213 1 Chapter 8 Serious Polymorphism Section 8.2 Objects don't bark hfjava2-CHP-8-SECT-2 137.14 214 1 Chapter 8 Serious Polymorphism Section 8.2 Get in touch with your inner Object hfjava2-CHP-8-SECT-2 137.15 215 1 Chapter 8 Serious Polymorphism Section 8.2 Polymorphism' means 'many forms'. hfjava2-CHP-8-SECT-2 137.16 216 1 Chapter 8 Serious Polymorphism Section 8.2 Casting an object reference back to its real type hfjava2-CHP-8-SECT-2 137.17 217 1 Chapter 8 Serious Polymorphism Section 8.2 So now you've seen how much Java cares about the methods in the class of the reference variable. hfjava2-CHP-8-SECT-2 137.18 218 1 Chapter 8 Serious Polymorphism Section 8.2 What if I need to change the contract? hfjava2-CHP-8-SECT-2 137.19 219 3 Chapter 8 Serious Polymorphism Section 8.2 Let's explore some design options for reusing some of our existing classes in a PetShop program. hfjava2-CHP-8-SECT-2 137.22 222 1 Chapter 8 Serious Polymorphism Section 8.2 So what we REALLY need is: hfjava2-CHP-8-SECT-2 137.23 223 1 Chapter 8 Serious Polymorphism Section 8.2 "It's called ""multiple inheritance"" and it can be a Really Bad Thing." hfjava2-CHP-8-SECT-2 137.24 224 1 Chapter 8 Serious Polymorphism Section 8.2 Interface to the rescue! hfjava2-CHP-8-SECT-3 137.9 225a 1 Chapter 8 Serious Polymorphism Section 8.3 Making an Implementing the Pet Interface hfjava2-CHP-8-SECT-3 138 225b 1 Chapter 8 Serious Polymorphism Section 8.3 there are no Dumb Questions hfjava2-CHP-8-SECT-3 138.26 226 1 Chapter 8 Serious Polymorphism Section 8.3 Classes from different inheritance trees can implement the same interface hfjava2-CHP-8-SECT-3 138.27 227 1 Chapter 8 Serious Polymorphism Section 8.3 "How do you know whether to make a class, a subclass, an abstract class, or an interface?" hfjava2-CHP-8-SECT-3 138.28 228 1 Chapter 8 Serious Polymorphism Section 8.3 Invoking the superclass version of a method hfjava2-CHP-8-SECT-3 138.29 229 1 Chapter 8 Serious Polymorphism Section 8.3 Bullet Points hfjava2-CHP-8-SECT-3 138.3 230 1 Chapter 8 Serious Polymorphism Section 8.3 Exercise: What's the picture? hfjava2-CHP-8-SECT-3 138.31 231 1 Chapter 8 Serious Polymorphism Section 8.3 Exercise: What's the declaration? hfjava2-CHP-8-SECT-4 139 232 1 Chapter 8 Serious Polymorphism Section 8.4 Pool Puzzle hfjava2-CHP-8-SECT-5 140 233 2 Chapter 8 Serious Polymorphism Section 8.5 Exercise Solutions hfjava2-CHP-9 141 235 1 Chapter 9 Life and Death of an Object Chapter 9 Life and Death of an Object hfjava2-CHP-9-SECT-1 142 236 1 Chapter 9 Life and Death of an Object Section 9.1 The Stack and the Heap: where things live hfjava2-CHP-9-SECT-2 143 237 1 Chapter 9 Life and Death of an Object Section 9.2 Methods are stacked hfjava2-CHP-9-SECT-3 144 238a 0 Chapter 9 Life and Death of an Object Section 9.3 What about local variables that are objects? hfjava2-CHP-9-SECT-4 145 238b 1 Chapter 9 Life and Death of an Object Section 9.4 there are no Dumb Questions hfjava2-CHP-9-SECT-5 146 239 1 Chapter 9 Life and Death of an Object Section 9.5 "If local variables live on the stack, where do instance variables live?" hfjava2-CHP-9-SECT-6 147 240 2 Chapter 9 Life and Death of an Object Section 9.6 The miracle of object creation hfjava2-CHP-9-SECT-7 148 242 1 Chapter 9 Life and Death of an Object Section 9.7 Construct a Duck hfjava2-CHP-9-SECT-8 149 243a 0 Chapter 9 Life and Death of an Object Section 9.8 Initializing the state of a new Duck hfjava2-CHP-9-SECT-9 150 243b 1 Chapter 9 Life and Death of an Object Section 9.9 there are no Dumb Questions hfjava2-CHP-9-SECT-10 151 244 1 Chapter 9 Life and Death of an Object Section 9.10 Using the constructor to initialize important Duck state hfjava2-CHP-9-SECT-11 152 245 1 Chapter 9 Life and Death of an Object Section 9.11 Make it easy to make a Duck hfjava2-CHP-9-SECT-12 153 246 2 Chapter 9 Life and Death of an Object Section 9.12 Doesn't the compiler always make a no-arg constructor for you? No! hfjava2-CHP-9-SECT-13 154 248 1 Chapter 9 Life and Death of an Object Section 9.13 there are no Dumb Questions hfjava2-CHP-9-SECT-14 155 249 1 Chapter 9 Life and Death of an Object Section 9.14 there are no Dumb Questions hfjava2-CHP-9-SECT-15 156 250 1 Chapter 9 Life and Death of an Object Section 9.15 Wait a minute... we never DID talk about superclasses and inheritance and how that all fits in with constructors. hfjava2-CHP-9-SECT-16 157 251 1 Chapter 9 Life and Death of an Object Section 9.16 Making a Hippo means making the Animal and Object parts too... hfjava2-CHP-9-SECT-17 158 252 2 Chapter 9 Life and Death of an Object Section 9.17 How do you invoke a superclass constructor? hfjava2-CHP-9-SECT-18 159 254 1 Chapter 9 Life and Death of an Object Section 9.18 Can the child exist before the parents? hfjava2-CHP-9-SECT-19 160 255 1 Chapter 9 Life and Death of an Object Section 9.19 Superclass constructors with arguments hfjava2-CHP-9-SECT-20 161 256 2 Chapter 9 Life and Death of an Object Section 9.20 Invoking one overloaded constructor from another hfjava2-CHP-9-SECT-21 162 258 2 Chapter 9 Life and Death of an Object Section 9.21 "Now we know how an object is born, but how long does an object live?" hfjava2-CHP-9-SECT-22 163 260 1 Chapter 9 Life and Death of an Object Section 9.22 What about reference variables? hfjava2-CHP-9-SECT-22 163.01 261 1 Chapter 9 Life and Death of an Object Section 9.22 Object-killer #1: Reference goes out of scope permanently hfjava2-CHP-9-SECT-22 163.02 262 1 Chapter 9 Life and Death of an Object Section 9.22 Object-killer #2: Assign the reference to another object hfjava2-CHP-9-SECT-22 163.03 263a 1 Chapter 9 Life and Death of an Object Section 9.22 Object-killer #3: Explicitly set the reference to null hfjava2-CHP-9-SECT-22 163.04 263b 1 Chapter 9 Life and Death of an Object Section 9.22 The meaning of null hfjava2-CHP-9-SECT-22 163.05 264 2 Chapter 9 Life and Death of an Object Section 9.22 Fireside Chats: An Instance variable and a local variable discuss life and death hfjava2-CHP-9-SECT-22 163.06 266 1 Chapter 9 Life and Death of an Object Section 9.22 Exercise: Be the garbage collector hfjava2-CHP-9-SECT-22 163.07 267 1 Chapter 9 Life and Death of an Object Section 9.22 Exercise Popular objects hfjava2-CHP-9-SECT-22 163.08 268 2 Chapter 9 Life and Death of an Object Section 9.22 Five Minute Mystery: Bug in a Temperature Simulation hfjava2-CHP-9-SECT-22 163.09 270 1 Chapter 9 Life and Death of an Object Section 9.22 Exercise Solutions: Garbage Collector and Popular Objects hfjava2-CHP-9-SECT-22 163.1 271 1 Chapter 9 Life and Death of an Object Section 9.22 Five-Minute Mystery Solution hfjava2-CHP-10 164 273 1 Chapter 10 Numbers Matter Chapter 10 Numbers Matter hfjava2-CHP-10-SECT-1 165 274 1 Chapter 10 Numbers Matter Section 10.1 MATH methods: as close as you'll ever get to a global method hfjava2-CHP-10-SECT-2 166 275 1 Chapter 10 Numbers Matter Section 10.2 The difference between regular (non-static) and static methods hfjava2-CHP-10-SECT-3 167 276 1 Chapter 10 Numbers Matter Section 10.3 What it means to have a class with static methods. hfjava2-CHP-10-SECT-4 168 277 1 Chapter 10 Numbers Matter Section 10.4 Static methods can't use non-static (instance) variables! hfjava2-CHP-10-SECT-5 169 278 1 Chapter 10 Numbers Matter Section 10.5 "Static methods can't use non-static methods, either!" hfjava2-CHP-10-SECT-6 170 279 2 Chapter 10 Numbers Matter Section 10.6 Static variable: value is the same for ALL instances of the class hfjava2-CHP-10-SECT-7 171 281 1 Chapter 10 Numbers Matter Section 10.7 Initializing a static variable hfjava2-CHP-10-SECT-8 172 282 1 Chapter 10 Numbers Matter Section 10.8 static final variables are constants hfjava2-CHP-10-SECT-9 173 283 1 Chapter 10 Numbers Matter Section 10.9 final isn't just for static variables... hfjava2-CHP-10-SECT-10 174 284 2 Chapter 10 Numbers Matter Section 10.10 there are no Dumb Questions hfjava2-CHP-10-SECT-11 175 286 1 Chapter 10 Numbers Matter Section 10.11 Math methods hfjava2-CHP-10-SECT-12 176 287 1 Chapter 10 Numbers Matter Section 10.12 Wrapping a primitive hfjava2-CHP-10-SECT-13 177 288 1 Chapter 10 Numbers Matter Section 10.13 "Before Java 5.0, YOU had to do the work..." hfjava2-CHP-10-SECT-14 178 289 1 Chapter 10 Numbers Matter Section 10.14 Autoboxing: blurring the line bet ween primitive and object hfjava2-CHP-10-SECT-15 179 290 2 Chapter 10 Numbers Matter Section 10.15 Autoboxing works almost everywhere hfjava2-CHP-10-SECT-16 180 292 1 Chapter 10 Numbers Matter Section 10.16 But wait! There's more! Wrappers have static utility methods too! hfjava2-CHP-10-SECT-17 181 293 1 Chapter 10 Numbers Matter Section 10.17 And now in reverse... turning a primitive number into a String hfjava2-CHP-10-SECT-18 182 294 1 Chapter 10 Numbers Matter Section 10.18 Number formatting hfjava2-CHP-10-SECT-19 183 295 1 Chapter 10 Numbers Matter Section 10.19 Formatting deconstructed... hfjava2-CHP-10-SECT-20 184 296 1 Chapter 10 Numbers Matter Section 10.20 "The percent (%) says, "insert argument here" (and format it using these instructions)" hfjava2-CHP-10-SECT-21 185 297 1 Chapter 10 Numbers Matter Section 10.21 The format String uses its own little language syntax hfjava2-CHP-10-SECT-22 186 298 1 Chapter 10 Numbers Matter Section 10.22 The format specifier hfjava2-CHP-10-SECT-23 187 299 1 Chapter 10 Numbers Matter Section 10.23 The only required specifier is for TYPE hfjava2-CHP-10-SECT-24 188 300 1 Chapter 10 Numbers Matter Section 10.24 What happens if I have more than one argument? hfjava2-CHP-10-SECT-25 189 301 1 Chapter 10 Numbers Matter Section 10.25 "So much for numbers, what about dates?" hfjava2-CHP-10-SECT-26 190 302 1 Chapter 10 Numbers Matter Section 10.26 Working with Dates hfjava2-CHP-10-SECT-27 191 303 1 Chapter 10 Numbers Matter Section 10.27 Moving backward and for ward in time hfjava2-CHP-10-SECT-28 192 304 1 Chapter 10 Numbers Matter Section 10.28 Getting an object that extends Calendar hfjava2-CHP-10-SECT-29 193 305 1 Chapter 10 Numbers Matter Section 10.29 Working with Calendar objects hfjava2-CHP-10-SECT-30 194 306 1 Chapter 10 Numbers Matter Section 10.30 Highlights of the Calendar API hfjava2-CHP-10-SECT-31 195 307 1 Chapter 10 Numbers Matter Section 10.31 Even more Statics!... static imports hfjava2-CHP-10-SECT-31 195.08 308 2 Chapter 10 Numbers Matter Section 10.31 Fireside Chats: An Instance variable takes cheap shots at a static variable hfjava2-CHP-10-SECT-31 195.1 310 1 Chapter 10 Numbers Matter Section 10.31 Exercise: Be the compiler hfjava2-CHP-10-SECT-31 195.11 311 1 Chapter 10 Numbers Matter Section 10.31 Exercise: True or False? hfjava2-CHP-10-SECT-32 196 312 3 Chapter 10 Numbers Matter Section 10.32 Lunar Code Magnets hfjava2-CHP-11 197 315 1 Chapter 11 Risky Behavior Chapter 11 Risky Behavior hfjava2-CHP-11-SECT-1 198 316 1 Chapter 11 Risky Behavior Section 11.1 Let's make a Music Machine hfjava2-CHP-11-SECT-2 199 317 1 Chapter 11 Risky Behavior Section 11.2 We'll start with the basics hfjava2-CHP-11-SECT-3 200 318a 0 Chapter 11 Risky Behavior Section 11.3 First we need a Sequencer hfjava2-CHP-11-SECT-4 201 318b 1 Chapter 11 Risky Behavior Section 11.4 Something's wrong! hfjava2-CHP-11-SECT-5 202 319 1 Chapter 11 Risky Behavior Section 11.5 What happens when a method you want to call (probably in a class you didn't write) is risky? hfjava2-CHP-11-SECT-6 203 320 1 Chapter 11 Risky Behavior Section 11.6 "Methods in Java use exceptions to tell the calling code, "Some thing Bad Happened. I failed."" hfjava2-CHP-11-SECT-7 204 321 1 Chapter 11 Risky Behavior Section 11.7 The compiler needs to know that YOU know you're calling a risky method. hfjava2-CHP-11-SECT-8 205 322 1 Chapter 11 Risky Behavior Section 11.8 An exception is an objectā of type Exception. hfjava2-CHP-11-SECT-9 206 323 1 Chapter 11 Risky Behavior Section 11.9 "If it's your code that catches the exception, then whose code throws it?" hfjava2-CHP-11-SECT-10 207 324 2 Chapter 11 Risky Behavior Section 11.10 there are no Dumb Questions hfjava2-CHP-11-SECT-11 208 326 1 Chapter 11 Risky Behavior Section 11.11 Flow control in try/catch blocks hfjava2-CHP-11-SECT-12 209 327 1 Chapter 11 Risky Behavior Section 11.12 Finally: for the things you want to do no matter what. hfjava2-CHP-11-SECT-13 210 328 1 Chapter 11 Risky Behavior Section 11.13 Sharpen your pencil:Flow Control hfjava2-CHP-11-SECT-14 211 329 1 Chapter 11 Risky Behavior Section 11.14 Did we mention that a method can throw more than one exception? hfjava2-CHP-11-SECT-15 212 330 2 Chapter 11 Risky Behavior Section 11.15 Exceptions are polymorphic hfjava2-CHP-11-SECT-16 213 332 1 Chapter 11 Risky Behavior Section 11.16 Multiple catch blocks must be ordered from smallest to biggest hfjava2-CHP-11-SECT-17 214 333 1 Chapter 11 Risky Behavior Section 11.17 You can't put bigger baskets above smaller baskets. hfjava2-CHP-11-SECT-18 215 334 1 Chapter 11 Risky Behavior Section 11.18 Sharpen your pencil hfjava2-CHP-11-SECT-19 216 335 1 Chapter 11 Risky Behavior Section 11.19 When you don't want to handle an exceptionā hfjava2-CHP-11-SECT-20 217 336 1 Chapter 11 Risky Behavior Section 11.20 Ducking (by declaring) only delays the inevitable hfjava2-CHP-11-SECT-21 218 337 1 Chapter 11 Risky Behavior Section 11.21 Getting back to our music codeā hfjava2-CHP-11-SECT-22 219 338 2 Chapter 11 Risky Behavior Section 11.22 Code Kitchen hfjava2-CHP-11-SECT-23 220 340 2 Chapter 11 Risky Behavior Section 11.23 Making actual sound hfjava2-CHP-11-SECT-24 221 342 1 Chapter 11 Risky Behavior Section 11.24 Your very first sound player app hfjava2-CHP-11-SECT-25 222 343 1 Chapter 11 Risky Behavior Section 11.25 Making a MidiEvent (song data) hfjava2-CHP-11-SECT-26 223 344 1 Chapter 11 Risky Behavior Section 11.26 MIDI message: the heart of a MidiEvent hfjava2-CHP-11-SECT-27 224 345 1 Chapter 11 Risky Behavior Section 11.27 Anatomy of a message hfjava2-CHP-11-SECT-28 225 346 2 Chapter 11 Risky Behavior Section 11.28 Version 2: Using command-line args to experiment with sounds hfjava2-CHP-11-SECT-29 226 348 1 Chapter 11 Risky Behavior Section 11.29 Exercise: True or False hfjava2-CHP-11-SECT-30 227 349 1 Chapter 11 Risky Behavior Section 11.30 Exercise: Code Magnets hfjava2-CHP-11-SECT-31 228 350 1 Chapter 11 Risky Behavior Section 11.31 JavaCross 7.0 hfjava2-CHP-11-SECT-32 229 351a 0 Chapter 11 Risky Behavior Section 11.32 Exercise Solutions: True or False hfjava2-CHP-11-SECT-33 230 351b 1 Chapter 11 Risky Behavior Section 11.33 Code Magnets hfjava2-CHP-11-SECT-34 231 352 1 Chapter 11 Risky Behavior Section 11.34 JavaCross Answers hfjava2-CHP-12 232 353 1 Chapter 12 A Very Graphic Story Chapter 12 A Very Graphic Story hfjava2-CHP-12-SECT-1 233 354 1 Chapter 12 A Very Graphic Story Section 12.1 It all starts with a window hfjava2-CHP-12-SECT-2 234 355 2 Chapter 12 A Very Graphic Story Section 12.2 Your first GUI: a button on a frame hfjava2-CHP-12-SECT-3 235 357 3 Chapter 12 A Very Graphic Story Section 12.3 Getting a user event hfjava2-CHP-12-SECT-4 236 360 2 Chapter 12 A Very Graphic Story Section 12.4 Getting a button's ActionEvent hfjava2-CHP-12-SECT-5 237 362 1 Chapter 12 A Very Graphic Story Section 12.5 There are no Dumb Questions hfjava2-CHP-12-SECT-5 237 363 1 Chapter 12 A Very Graphic Story Section 12.5 Getting back to graphics hfjava2-CHP-12-SECT-6 238 364 1 Chapter 12 A Very Graphic Story Section 12.6 Make your own drawing widget hfjava2-CHP-12-SECT-6 238.65 365 1 Chapter 12 A Very Graphic Story Section 12.6 Fun things to do in paintComponent() hfjava2-CHP-12-SECT-6 238.66 366 1 Chapter 12 A Very Graphic Story Section 12.6 Behind every good Graphics reference is a Graphics2D object hfjava2-CHP-12-SECT-6 238.67 367 1 Chapter 12 A Very Graphic Story Section 12.6 Because life's too short to paint the circle a solid color when there's a gradient blend waiting for you hfjava2-CHP-12-SECT-8 239 368 1 Chapter 12 A Very Graphic Story Section 12.8 BULLET POINTS hfjava2-CHP-12-SECT-9 240 369 1 Chapter 12 A Very Graphic Story Section 12.9 But can we paint graphics when we get an event? hfjava2-CHP-12-SECT-9 240.7 370 1 Chapter 12 A Very Graphic Story Section 12.9 GUI layouts: putting more than one widget on a frame hfjava2-CHP-12-SECT-9 240.71 371 1 Chapter 12 A Very Graphic Story Section 12.9 The circle changes color each time you click the button hfjava2-CHP-12-SECT-10 241 372 1 Chapter 12 A Very Graphic Story Section 12.10 Let's try it with TWO buttons hfjava2-CHP-12-SECT-10 241.73 373 2 Chapter 12 A Very Graphic Story Section 12.10 "How do you get action events for two different buttons, which each button needs to do something different?" hfjava2-CHP-12-SECT-10 241.75 375 1 Chapter 12 A Very Graphic Story Section 12.10 Wouldn't it be wonderful if you could have two different listener classesā hfjava2-CHP-12-SECT-10 241.76 376 1 Chapter 12 A Very Graphic Story Section 12.10 Inner class to the rescue! hfjava2-CHP-12-SECT-10 241.77 377 1 Chapter 12 A Very Graphic Story Section 12.10 An inner class instance must be tied to an outer class instance.* hfjava2-CHP-12-SECT-10 241.78 378 1 Chapter 12 A Very Graphic Story Section 12.10 How to make an instance of an inner class hfjava2-CHP-12-SECT-10 241.79 379 1 Chapter 12 A Very Graphic Story Section 12.10 Now we can get the two-button code working hfjava2-CHP-12-SECT-11 242 380 2 Chapter 12 A Very Graphic Story Section 12.11 Java Exposed: This weeks interview: Instance of an Inner Class hfjava2-CHP-12-SECT-12 243 382 4 Chapter 12 A Very Graphic Story Section 12.12 There are no Dumb Questions hfjava2-CHP-12-SECT-13 244 386 1 Chapter 12 A Very Graphic Story Section 12.13 Code Kitchen: Music Video hfjava2-CHP-12-SECT-13 244.87 387 1 Chapter 12 A Very Graphic Story Section 12.13 Listening for a non-GUI event hfjava2-CHP-12-SECT-13 244.88 388 1 Chapter 12 A Very Graphic Story Section 12.13 An easier way to make messages/events hfjava2-CHP-12-SECT-13 244.89 389 1 Chapter 12 A Very Graphic Story Section 12.13 Example: how to make the new static makeEvent() method hfjava2-CHP-12-SECT-13 244.9 390 1 Chapter 12 A Very Graphic Story Section 12.13 Version Two: registering and getting ControllerEvents hfjava2-CHP-12-SECT-13 244.91 391 1 Chapter 12 A Very Graphic Story Section 12.13 Version Three: drawing graphics in time with the music hfjava2-CHP-12-SECT-13 244.92 392 2 Chapter 12 A Very Graphic Story Section 12.13 Sharpen your pencil: Annotate the code for version 3 hfjava2-CHP-12-SECT-14 245 394 1 Chapter 12 A Very Graphic Story Section 12.14 Exercise: Who am I? hfjava2-CHP-12-SECT-15 246 395 1 Chapter 12 A Very Graphic Story Section 12.15 Exercise: BE the compiler hfjava2-CHP-12-SECT-16 247 396 1 Chapter 12 A Very Graphic Story Section 12.16 Pool Puzzle hfjava2-CHP-12-SECT-17 248 397 1 Chapter 12 A Very Graphic Story Section 12.17 Exercise Solutions: Who am I? hfjava2-CHP-12-SECT-18 249 398 1 Chapter 12 A Very Graphic Story Section 12.18 Pool Puzzle hfjava2-CHP-13 250 399 1 Chapter 13 Work on Your Swing Chapter 13 Work on Your Swing hfjava2-CHP-13-SECT-1 251 400 1 Chapter 13 Work on Your Swing Section 13.1 Swing components hfjava2-CHP-13-SECT-2 252 401 1 Chapter 13 Work on Your Swing Section 13.2 Layout Managers hfjava2-CHP-13-SECT-3 253 402 1 Chapter 13 Work on Your Swing Section 13.3 How does the layout manager decide? hfjava2-CHP-13-SECT-4 254 403 1 Chapter 13 Work on Your Swing Section 13.4 "The Big Three layout managers: border, flow, and box." hfjava2-CHP-13-SECT-4 254.04 404 1 Chapter 13 Work on Your Swing Section 13.4 "BorderLayout cares about five regions: east, west, north, south and center" hfjava2-CHP-13-SECT-4 254.05 405 1 Chapter 13 Work on Your Swing Section 13.4 Watch what happens when we give the button more characters hfjava2-CHP-13-SECT-4 254.06 406 1 Chapter 13 Work on Your Swing Section 13.4 Let's try a button in the NORTH region hfjava2-CHP-13-SECT-4 254.07 407 1 Chapter 13 Work on Your Swing Section 13.4 But what happens in the center region? hfjava2-CHP-13-SECT-4 254.08 408 1 Chapter 13 Work on Your Swing Section 13.4 FlowLayout cares about the flow of the components hfjava2-CHP-13-SECT-4 254.09 409 1 Chapter 13 Work on Your Swing Section 13.4 Let's add a button to the panel hfjava2-CHP-13-SECT-4 254.1 410 1 Chapter 13 Work on Your Swing Section 13.4 What happens if we add TWO buttons to the panel? hfjava2-CHP-13-SECT-4 254.11 411 1 Chapter 13 Work on Your Swing Section 13.4 BoxLayout to the rescue! hfjava2-CHP-13-SECT-5 255 412 1 Chapter 13 Work on Your Swing Section 13.5 there are no Dumb Questions hfjava2-CHP-13-SECT-6 256 413 3 Chapter 13 Work on Your Swing Section 13.6 Playing with Swing components hfjava2-CHP-13-SECT-7 257 416 2 Chapter 13 Work on Your Swing Section 13.7 there are no Dumb Questions hfjava2-CHP-13-SECT-8 258 418 1 Chapter 13 Work on Your Swing Section 13.8 Code Kitchen hfjava2-CHP-13-SECT-9 259 419 5 Chapter 13 Work on Your Swing Section 13.9 Making the BeatBox hfjava2-CHP-13-SECT-10 260 424 1 Chapter 13 Work on Your Swing Section 13.10 Exercise: Which code goes with which layout? hfjava2-CHP-13-SECT-11 261 425 4 Chapter 13 Work on Your Swing Section 13.11 Code Fragments hfjava2-CHP-14 262 429 1 Chapter 14 Saving Objects Chapter 14 Saving Objects hfjava2-CHP-14-SECT-1 263 430 1 Chapter 14 Saving Objects Section 14.1 Capture the Beat hfjava2-CHP-14-SECT-2 264 431 1 Chapter 14 Saving Objects Section 14.2 Saving State hfjava2-CHP-14-SECT-3 265 432 1 Chapter 14 Saving Objects Section 14.3 Writing a serialized object to a file hfjava2-CHP-14-SECT-4 266 433 1 Chapter 14 Saving Objects Section 14.4 Data moves in streams from one place to another hfjava2-CHP-14-SECT-5 267 434 1 Chapter 14 Saving Objects Section 14.5 What really happens to an object when it's serialized? hfjava2-CHP-14-SECT-6 268 435 2 Chapter 14 Saving Objects Section 14.6 But what exactly IS an object's state? What needs to be saved? hfjava2-CHP-14-SECT-7 269 437 3 Chapter 14 Saving Objects Section 14.7 "If you want your class to be serializable, implement Serializable" hfjava2-CHP-14-SECT-8 270 440 1 Chapter 14 Saving Objects Section 14.8 There are no Dumb Questions hfjava2-CHP-14-SECT-9 271 441 1 Chapter 14 Saving Objects Section 14.9 Deserialization: restoring an object hfjava2-CHP-14-SECT-10 272 442 1 Chapter 14 Saving Objects Section 14.10 What happens during deserialization? hfjava2-CHP-14-SECT-11 273 443 1 Chapter 14 Saving Objects Section 14.11 There are no Dumb Questions hfjava2-CHP-14-SECT-12 274 444 1 Chapter 14 Saving Objects Section 14.12 Saving and restoring the game characters hfjava2-CHP-14-SECT-13 275 445 1 Chapter 14 Saving Objects Section 14.13 The GameCharacter class hfjava2-CHP-14-SECT-14 276 446 1 Chapter 14 Saving Objects Section 14.14 Object Serialization hfjava2-CHP-14-SECT-15 277 447 1 Chapter 14 Saving Objects Section 14.15 Writing a String to a Text File hfjava2-CHP-14-SECT-16 278 448 1 Chapter 14 Saving Objects Section 14.16 Text File Example: e-Flashcards hfjava2-CHP-14-SECT-17 279 449 3 Chapter 14 Saving Objects Section 14.17 Quiz Card Builder (code outline) hfjava2-CHP-14-SECT-18 280 452 1 Chapter 14 Saving Objects Section 14.18 The java.io.File class hfjava2-CHP-14-SECT-19 281 453 1 Chapter 14 Saving Objects Section 14.19 The beauty of buffers hfjava2-CHP-14-SECT-20 282 454 1 Chapter 14 Saving Objects Section 14.20 Reading from a Text File hfjava2-CHP-14-SECT-21 283 455 3 Chapter 14 Saving Objects Section 14.21 Quiz Card Player (code outline) hfjava2-CHP-14-SECT-22 284 458 1 Chapter 14 Saving Objects Section 14.22 Parsing with String split() hfjava2-CHP-14-SECT-23 285 459 1 Chapter 14 Saving Objects Section 14.23 There are no Dumb Questions hfjava2-CHP-14-SECT-24 286 460 1 Chapter 14 Saving Objects Section 14.24 Version ID: A Big Serialization Gotcha hfjava2-CHP-14-SECT-25 287 461 1 Chapter 14 Saving Objects Section 14.25 Using the serialVersionUID hfjava2-CHP-14-SECT-26 288 462 1 Chapter 14 Saving Objects Section 14.26 Code Kitchen hfjava2-CHP-14-SECT-27 289 463 1 Chapter 14 Saving Objects Section 14.27 Saving a BeatBox pattern hfjava2-CHP-14-SECT-28 290 464 1 Chapter 14 Saving Objects Section 14.28 Restoring a BeatBox pattern hfjava2-CHP-14-SECT-29 291 465 1 Chapter 14 Saving Objects Section 14.29 Sharpen your pencil: Can they be saved? hfjava2-CHP-14-SECT-30 292 466 1 Chapter 14 Saving Objects Section 14.30 Exercise: True or False hfjava2-CHP-14-SECT-31 293 467 1 Chapter 14 Saving Objects Section 14.31 Code Magnets hfjava2-CHP-14-SECT-32 294 468 3 Chapter 14 Saving Objects Section 14.32 Exercise Solutions hfjava2-CHP-15 295 471 1 Chapter 15 Make a Connection Chapter 15 Make a Connection hfjava2-CHP-15-SECT-1 296 472 2 Chapter 15 Make a Connection Section 15.1 Real-time Beat Box Chat hfjava2-CHP-15-SECT-2 297 474 1 Chapter 15 Make a Connection Section 15.2 "Connecting, Sending, and Receiving" hfjava2-CHP-15-SECT-3 298 475 2 Chapter 15 Make a Connection Section 15.3 Make a network Socket connection hfjava2-CHP-15-SECT-4 299 477 1 Chapter 15 Make a Connection Section 15.4 A TCP port is just a number: A 16-bit number that identifies a specific program on the server. hfjava2-CHP-15-SECT-5 300 478 1 Chapter 15 Make a Connection Section 15.5 "To read data from a Socket, use a BufferedReader" hfjava2-CHP-15-SECT-6 301 479 1 Chapter 15 Make a Connection Section 15.6 "To write data to a Socket, use a PrintWriter" hfjava2-CHP-15-SECT-7 302 480 3 Chapter 15 Make a Connection Section 15.7 DailyAdviceClient code hfjava2-CHP-15-SECT-8 303 483 1 Chapter 15 Make a Connection Section 15.8 Writing a simple server hfjava2-CHP-15-SECT-9 304 484 2 Chapter 15 Make a Connection Section 15.9 DailyAdviceServer code hfjava2-CHP-15-SECT-10 305 486 4 Chapter 15 Make a Connection Section 15.10 Writing a Chat Client hfjava2-CHP-15-SECT-11 306 490 1 Chapter 15 Make a Connection Section 15.11 Java has multiple threads but only one Thread class hfjava2-CHP-15-SECT-12 307 491 2 Chapter 15 Make a Connection Section 15.12 What does it mean to have more than one call stack? hfjava2-CHP-15-SECT-13 308 493 1 Chapter 15 Make a Connection Section 15.13 Every Thread needs a job to do: A method to put on the new thread stack. hfjava2-CHP-15-SECT-14 309 494 3 Chapter 15 Make a Connection Section 15.14 "To make a job for your thread, implement the Runnable interface" hfjava2-CHP-15-SECT-15 310 497 3 Chapter 15 Make a Connection Section 15.15 The Thread Scheduler hfjava2-CHP-15-SECT-16 311 500 1 Chapter 15 Make a Connection Section 15.16 there are no Dumb Questions hfjava2-CHP-15-SECT-17 312 501 1 Chapter 15 Make a Connection Section 15.17 Putting a thread to sleep hfjava2-CHP-15-SECT-18 313 502 1 Chapter 15 Make a Connection Section 15.18 Using sleep to make our program more predictable. hfjava2-CHP-15-SECT-19 314 503a 0 Chapter 15 Make a Connection Section 15.19 Making and starting two threads hfjava2-CHP-15-SECT-20 315 503b 1 Chapter 15 Make a Connection Section 15.20 What will happen? hfjava2-CHP-15-SECT-21 316 504 2 Chapter 15 Make a Connection Section 15.21 "Um, yes. There IS a dark side. Threads can lead to concurrency 'issues'." hfjava2-CHP-15-SECT-22 317 506 1 Chapter 15 Make a Connection Section 15.22 "The Ryan and Monica problem, in code" hfjava2-CHP-15-SECT-23 318 507 3 Chapter 15 Make a Connection Section 15.23 The Ryan and Monica example hfjava2-CHP-15-SECT-24 319 510 1 Chapter 15 Make a Connection Section 15.24 We need the makeWithdrawal ( ) method to run as one atomic thing. hfjava2-CHP-15-SECT-25 320 511 1 Chapter 15 Make a Connection Section 15.25 Using an object's lock hfjava2-CHP-15-SECT-26 321 512 1 Chapter 15 Make a Connection Section 15.26 The dreaded "Lost Update" problem hfjava2-CHP-15-SECT-27 322 513 1 Chapter 15 Make a Connection Section 15.27 Let's run this code... hfjava2-CHP-15-SECT-28 323 514a 0 Chapter 15 Make a Connection Section 15.28 Make the increment() method atomic. Synchronize it! hfjava2-CHP-15-SECT-29 324 514b 2 Chapter 15 Make a Connection Section 15.29 there are no Dumb Questions hfjava2-CHP-15-SECT-30 325 516 2 Chapter 15 Make a Connection Section 15.30 The deadly side of synchronization hfjava2-CHP-15-SECT-31 326 518 2 Chapter 15 Make a Connection Section 15.31 New and improved SimpleChatClient hfjava2-CHP-15-SECT-32 327 520 2 Chapter 15 Make a Connection Section 15.32 Ready-bake Code: The really really simple Chat Server hfjava2-CHP-15-SECT-33 328 522 1 Chapter 15 Make a Connection Section 15.33 there are no Dumb Questions hfjava2-CHP-15-SECT-34 329 523 1 Chapter 15 Make a Connection Section 15.34 Code Kitchen hfjava2-CHP-15-SECT-35 330 524 2 Chapter 15 Make a Connection Section 15.35 Exercise: Code Magnets hfjava2-CHP-15-SECT-36 331 526 1 Chapter 15 Make a Connection Section 15.36 Exercise Solutions hfjava2-CHP-15-SECT-37 332 527 2 Chapter 15 Make a Connection Section 15.37 Five-Minute Mystery hfjava2-CHP-16 333 529 1 Chapter 16 Data structures Chapter 16 Data structures hfjava2-CHP-16-SECT-1 334 530 1 Chapter 16 Data structures Section 16.1 Tracking song popularity on your jukebox hfjava2-CHP-16-SECT-2 335 531 1 Chapter 16 Data structures Section 16.2 "Here's what you have so far, without the sort:" hfjava2-CHP-16-SECT-3 336 532 1 Chapter 16 Data structures Section 16.3 But the ArrayList class does NOT have a sort() method! hfjava2-CHP-16-SECT-4 337 533 1 Chapter 16 Data structures Section 16.4 ArrayList is not the only collection hfjava2-CHP-16-SECT-5 338 534 1 Chapter 16 Data structures Section 16.5 You could use a TreeSet... Or you could use the Collections.sort() method hfjava2-CHP-16-SECT-6 339 535 1 Chapter 16 Data structures Section 16.6 Adding Collections.sort() to the Jukebox code hfjava2-CHP-16-SECT-7 340 536 1 Chapter 16 Data structures Section 16.7 "But now you need Song objects, not just simple Strings." hfjava2-CHP-16-SECT-8 341 537 1 Chapter 16 Data structures Section 16.8 Changing the Jukebox code to use Songs instead of Strings hfjava2-CHP-16-SECT-9 342 538 1 Chapter 16 Data structures Section 16.9 It won't compile! hfjava2-CHP-16-SECT-10 343 539 1 Chapter 16 Data structures Section 16.10 The sort() method declaration hfjava2-CHP-16-SECT-11 344 540 1 Chapter 16 Data structures Section 16.11 Generics means more type-safety hfjava2-CHP-16-SECT-12 345 541 1 Chapter 16 Data structures Section 16.12 Learning generics hfjava2-CHP-16-SECT-13 346 542 1 Chapter 16 Data structures Section 16.13 Using generic CLASSES hfjava2-CHP-16-SECT-14 347 543 1 Chapter 16 Data structures Section 16.14 Using type parameters with ArrayList hfjava2-CHP-16-SECT-15 348 544 1 Chapter 16 Data structures Section 16.15 Using generic METHODS hfjava2-CHP-16-SECT-16 349 545 2 Chapter 16 Data structures Section 16.16 Here's where it gets weird... hfjava2-CHP-16-SECT-17 350 547 1 Chapter 16 Data structures Section 16.17 Revisiting the sort() method hfjava2-CHP-16-SECT-18 351 548 1 Chapter 16 Data structures Section 16.18 "In generics, "extends" means "extends or implements"" hfjava2-CHP-16-SECT-19 352 549 1 Chapter 16 Data structures Section 16.19 Finally we know what's wrong... hfjava2-CHP-16-SECT-20 353 550 1 Chapter 16 Data structures Section 16.20 "The new, improved, comparable Song class" hfjava2-CHP-16-SECT-21 354 551 1 Chapter 16 Data structures Section 16.21 "We can sort the list, but..." hfjava2-CHP-16-SECT-22 355 552 1 Chapter 16 Data structures Section 16.22 Using a custom comparator hfjava2-CHP-16-SECT-23 356 553 1 Chapter 16 Data structures Section 16.23 Updating the Jukebox to use a Comparator hfjava2-CHP-16-SECT-24 357 554 1 Chapter 16 Data structures Section 16.24 Sharpen your pencil: Reverse Engineer hfjava2-CHP-16-SECT-25 358 555 1 Chapter 16 Data structures Section 16.25 Sharpen your pencil: Fill-in-the-blanks hfjava2-CHP-16-SECT-26 359 556 1 Chapter 16 Data structures Section 16.26 "Uh-oh. The sorting all works, but now we have duplicates..." hfjava2-CHP-16-SECT-27 360 557 1 Chapter 16 Data structures Section 16.27 We need a Set instead of a List hfjava2-CHP-16-SECT-28 361 558 1 Chapter 16 Data structures Section 16.28 The Collection API (part of it) hfjava2-CHP-16-SECT-29 362 559 1 Chapter 16 Data structures Section 16.29 Using a HashSet instead of ArrayList hfjava2-CHP-16-SECT-30 363 560 1 Chapter 16 Data structures Section 16.30 What makes two objects equal? hfjava2-CHP-16-SECT-31 364 561 1 Chapter 16 Data structures Section 16.31 How a HashSet checks for duplicates: hashCode() and equals() hfjava2-CHP-16-SECT-32 365 562 1 Chapter 16 Data structures Section 16.32 The Song class with overridden hashCode() and equals() hfjava2-CHP-16-SECT-33 366 563 1 Chapter 16 Data structures Section 16.33 there are no Dumb Questions hfjava2-CHP-16-SECT-34 367 564 1 Chapter 16 Data structures Section 16.34 "And if we want the set to stay sorted, we've got TreeSet" hfjava2-CHP-16-SECT-35 368 565 1 Chapter 16 Data structures Section 16.35 What you MUST know about TreeSet... hfjava2-CHP-16-SECT-36 369 566 1 Chapter 16 Data structures Section 16.36 TreeSet elements MUST be comparable hfjava2-CHP-16-SECT-37 370 567 1 Chapter 16 Data structures Section 16.37 "We've seen Lists and Sets, now we'll use a Map" hfjava2-CHP-16-SECT-38 371 568 1 Chapter 16 Data structures Section 16.38 "Finally, back to generics" hfjava2-CHP-16-SECT-39 372 569 1 Chapter 16 Data structures Section 16.39 Using polymorphic arguments and generics hfjava2-CHP-16-SECT-40 373 570 1 Chapter 16 Data structures Section 16.40 But will it work with ArrayList<Dog> ? hfjava2-CHP-16-SECT-41 374 571 3 Chapter 16 Data structures Section 16.41 What could happen if it were allowed... hfjava2-CHP-16-SECT-42 375 574 1 Chapter 16 Data structures Section 16.42 Wildcards to the rescue hfjava2-CHP-16-SECT-43 376 575a 0 Chapter 16 Data structures Section 16.43 Alternate syntax for doing the same thing hfjava2-CHP-16-SECT-44 377 575b 1 Chapter 16 Data structures Section 16.44 there are no Dumb Questions hfjava2-CHP-16-SECT-45 378 576 1 Chapter 16 Data structures Section 16.45 "Exercise: BE the compiler, advanced" hfjava2-CHP-16-SECT-46 379 577 1 Chapter 16 Data structures Section 16.46 Solution to the "Reverse Engineer" sharpen exercise hfjava2-CHP-16-SECT-47 380 578 1 Chapter 16 Data structures Section 16.47 Exercise Solution hfjava2-CHP-16-SECT-48 381 579 2 Chapter 16 Data structures Section 16.48 BE the compiler solution hfjava2-CHP-17 382 581 1 Chapter 17 Release Your Code Chapter 17 Release Your Code hfjava2-CHP-17-SECT-1 383 582 1 Chapter 17 Release Your Code Section 17.1 Deploying your application hfjava2-CHP-17-SECT-2 384 583 1 Chapter 17 Release Your Code Section 17.2 Imagine this scenario... hfjava2-CHP-17-SECT-3 385 584 1 Chapter 17 Release Your Code Section 17.3 Separate source code and class files hfjava2-CHP-17-SECT-4 386 585 1 Chapter 17 Release Your Code Section 17.4 Put your Java in a JAR hfjava2-CHP-17-SECT-5 387 586 1 Chapter 17 Release Your Code Section 17.5 Running (executing) the JAR hfjava2-CHP-17-SECT-6 388 587 1 Chapter 17 Release Your Code Section 17.6 Put your classes in packages! hfjava2-CHP-17-SECT-7 389 588 2 Chapter 17 Release Your Code Section 17.7 Preventing package name conflicts hfjava2-CHP-17-SECT-8 390 590 1 Chapter 17 Release Your Code Section 17.8 Compiling and running with packages hfjava2-CHP-17-SECT-9 391 591 1 Chapter 17 Release Your Code Section 17.9 The -d flag is even cooler then we said hfjava2-CHP-17-SECT-10 392 592 1 Chapter 17 Release Your Code Section 17.10 Making an executable JAR with packages hfjava2-CHP-17-SECT-11 393 593 4 Chapter 17 Release Your Code Section 17.11 So where did the manifest file go? hfjava2-CHP-17-SECT-12 394 597 2 Chapter 17 Release Your Code Section 17.12 Java Web Start hfjava2-CHP-17-SECT-13 395 599 1 Chapter 17 Release Your Code Section 17.13 The .jnlp file hfjava2-CHP-17-SECT-14 396 600 1 Chapter 17 Release Your Code Section 17.14 Steps for making and deploying a Java Web Start app hfjava2-CHP-17-SECT-15 397 601 1 Chapter 17 Release Your Code Section 17.15 What's First? hfjava2-CHP-17-SECT-16 398 602 1 Chapter 17 Release Your Code Section 17.16 True or False hfjava2-CHP-17-SECT-17 399 603 4 Chapter 17 Release Your Code Section 17.17 Summary-Cross 7.0 hfjava2-CHP-18 400 607 1 Chapter 18 Distributed Computing Chapter 18 Distributed Computing hfjava2-CHP-18-SECT-1 401 608 1 Chapter 18 Distributed Computing Section 18.1 Method calls are always bet ween two objects on the same heap. hfjava2-CHP-18-SECT-2 402 609 1 Chapter 18 Distributed Computing Section 18.2 What if you want to invoke a method on an object running on another machine? hfjava2-CHP-18-SECT-3 403 610a 0 Chapter 18 Distributed Computing Section 18.3 "Object A, running on Little, wants to call a method on Object B, running on Big" hfjava2-CHP-18-SECT-4 404 610b 2 Chapter 18 Distributed Computing Section 18.4 But you can't do that hfjava2-CHP-18-SECT-5 405 612 2 Chapter 18 Distributed Computing Section 18.5 The role of the 'helpers' hfjava2-CHP-18-SECT-6 406 614 1 Chapter 18 Distributed Computing Section 18.6 Java RMI gives you the client and service helper objects! hfjava2-CHP-18-SECT-6 406.15 615 1 Chapter 18 Distributed Computing Section 18.6 Making the Remote Service hfjava2-CHP-18-SECT-6 406.16 616 1 Chapter 18 Distributed Computing Section 18.6 Step one: Make a Remote Interface hfjava2-CHP-18-SECT-6 406.17 617 1 Chapter 18 Distributed Computing Section 18.6 Step two: Make a Remote Implementation hfjava2-CHP-18-SECT-6 406.18 618 1 Chapter 18 Distributed Computing Section 18.6 Step Three: generate stubs and skeletons hfjava2-CHP-18-SECT-6 406.19 619 1 Chapter 18 Distributed Computing Section 18.6 Complete Code for the server side hfjava2-CHP-18-SECT-7 407 620 1 Chapter 18 Distributed Computing Section 18.7 How does the client get the stub object? hfjava2-CHP-18-SECT-8 408 621 1 Chapter 18 Distributed Computing Section 18.8 How does the client get the stub class? hfjava2-CHP-18-SECT-9 409 622 1 Chapter 18 Distributed Computing Section 18.9 Be sure each machine has the class files it needs. hfjava2-CHP-18-SECT-10 410 623 1 Chapter 18 Distributed Computing Section 18.10 Sharpen your pencil: What's First? hfjava2-CHP-18-SECT-11 411 624 1 Chapter 18 Distributed Computing Section 18.11 "Yeah, but who really uses RMI?" hfjava2-CHP-18-SECT-12 412 625 2 Chapter 18 Distributed Computing Section 18.12 What about Servlets? hfjava2-CHP-18-SECT-13 413 627a 0 Chapter 18 Distributed Computing Section 18.13 A very simple Ser vlet hfjava2-CHP-18-SECT-14 414 627b 1 Chapter 18 Distributed Computing Section 18.14 HTML page with a link to this servlet hfjava2-CHP-18-SECT-15 415 628 1 Chapter 18 Distributed Computing Section 18.15 There are no Dumb Questions hfjava2-CHP-18-SECT-16 416 629 1 Chapter 18 Distributed Computing Section 18.16 "Just for fun, let's make the Phrase-O-Matic work as a servlet" hfjava2-CHP-18-SECT-17 417 630 1 Chapter 18 Distributed Computing Section 18.17 "Phrase-O-Matic code, servlet-friendly" hfjava2-CHP-18-SECT-18 418 631 1 Chapter 18 Distributed Computing Section 18.18 Enterprise JavaBeans: RMI on steroids hfjava2-CHP-18-SECT-19 419 632 1 Chapter 18 Distributed Computing Section 18.19 For our final trick... a little Jini hfjava2-CHP-18-SECT-20 420 633 2 Chapter 18 Distributed Computing Section 18.20 Adaptive discovery in action hfjava2-CHP-18-SECT-21 421 635 1 Chapter 18 Distributed Computing Section 18.21 Self-healing network in action hfjava2-CHP-18-SECT-22 422 636 1 Chapter 18 Distributed Computing Section 18.22 Final Project: the Universal Service browser hfjava2-CHP-18-SECT-23 423 637 2 Chapter 18 Distributed Computing Section 18.23 How it works: hfjava2-CHP-18-SECT-24 424 639 5 Chapter 18 Distributed Computing Section 18.24 The classes and interfaces: hfjava2-CHP-18-SECT-25 425 644 4 Chapter 18 Distributed Computing Section 18.25 Sharpen your pencil hfjava2-CHP-18-SECT-26 426 648 1 Chapter 18 Distributed Computing Section 18.26 Congratulations! hfjava2-APP-A 427 649 1 Appendix A Final Code Kitchen Appendix A Final Code Kitchen hfjava2-APP-A-SECT-1 428 650 9 Appendix A Final Code Kitchen Section A.1 Final BeatBox client program hfjava2-APP-B 429 659 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Appendix B The Top Ten Topics that almost made it into the Real Book... hfjava2-APP-B-SECT-1 430 660 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.1. #10 Bit Manipulation hfjava2-APP-B-SECT-2 431 661 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.2 #9 Immutability hfjava2-APP-B-SECT-3 432 662 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.3 #8 Assertions hfjava2-APP-B-SECT-4 433 663 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.4 #7 Block Scope hfjava2-APP-B-SECT-5 434 664 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.5 #6 Linked Invocations hfjava2-APP-B-SECT-6 435 665 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.6 #5 Anonymous and Static Nested Classes hfjava2-APP-B-SECT-7 436 666 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.7 "#5 Anonymous and Static Nested Classes, continued" hfjava2-APP-B-SECT-8 437 667 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.8 #4 Access Levels and Access Modifiers (Who Sees What) hfjava2-APP-B-SECT-9 438 668 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.9 "#4 Access Levels and Access Modifiers, cont." hfjava2-APP-B-SECT-10 439 669 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.10. #3 String and StringBuffer/StringBuilder Methods hfjava2-APP-B-SECT-11 440 670 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.11. #2 Multidimensional Arrays hfjava2-APP-B-SECT-12 441 671 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.12. And the number one topic that didn't quite make it in... #1 Enumerations (also called Enumerated Types or Enums) hfjava2-APP-B-SECT-13 442 672 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.13. Using "if" and "switch" with Enums hfjava2-APP-B-SECT-14 443 673 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.14. "#1 Enumerations, completed" hfjava2-APP-B-SECT-15 444 674 1 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.15. Five-Minute Mystery: A Long Trip Home hfjava2-APP-B-SECT-16 445 675 2 Appendix B The Top Ten Topics that almost made it into the Real Book... Section B.16. Five-Minute Mystery Solution index 446 677 1 Index Index Index Index