OCJP Oracle certified programmer for java 6 exam 310-065 (2008)
Praise for the Sun Certified Programmer & Developer for Java 2 Study Guide
"Kathy Sierra is one of the few people in the world who can make complicated
things seem damn simple. And as if that isn't enough, she can make boring things
seem interesting. I always look forward to reading whatever Kathy writes—she's one
of my favorite authors."
—Paul Wheaton, Trail Boss JavaRanch.com
"Who better to write a Java study guide than Kathy Sierra, the reigning queen of
Java instruction? Kathy Sierra has done it again—here is a study guide that almost
guarantees you a certification!"
—James Cubeta, Systems Engineer, SGI
"The thing I appreciate most about Kathy is her quest to make us all remember that
we are teaching people and not just lecturing about Java. Her passion and desire
for the highest quality education that meets the needs of the individual student is
positively unparalleled at SunEd. Undoubtedly there are hundreds of students who
have benefited from taking Kathy's classes."
—Victor Peters, founder Next Step Education & Software Sun Certified Java Instructor
"I want to thank Kathy for the EXCELLENT Study Guide. The book is well written,
every concept is clearly explained using a real life example, and the book states what
you specifically need to know for the exam. The way it's written, you feel that you're
in a classroom and someone is actually teaching you the difficult concepts, but not
in a dry, formal manner. The questions at the end of the chapters are also REALLY
good, and I am sure they will help candidates pass the test. Watch out for this
Wickedly Smart book."
—Alfred Raouf, Web Solution Developer
"The Sun Certification exam was certainly no walk in the park, but Kathy's material
allowed me to not only pass the exam, but Ace it!"
—Mary Whetsel, Sr. Technology Specialist,
Application Strategy and Integration, The St. Paul Companies
"Bert has an uncanny and proven ability to synthesize complexity into simplicity
offering a guided tour into learning what's needed for the certification exam."
—Thomas Bender, President, Gold Hill Software Design, Inc.
"With his skill for clearly expressing complex concepts to his training audience,
every student can master what Bert has to teach."
—David Ridge, CEO, Ridge Associates
"I found this book to be extremely helpful in passing the exam. It was very well
written with just enough light-hearted comments to make you forget that you were
studying for a very difficult test. HIGHLY RECOMMENDED!!"
— Nicole Y. McCullough
"I have never enjoyed reading a technical book as much as I did this one…This
morning I took the SCJP test and got 98% (60 out of 61) correct. Such success
would not have been possible without this book!"
— Yurie Nagorny
"I gave SCJP 1.4 in July 2004 & scored 95% (58/61). Kathy & Bert have an
awesome writing style & they literally burnt the core concepts into my head."
— Bhushan P. Madan (Kansas, United States)
"I just took my certification test last week and passed with a score of 95%. Had I not
gone through this book, there would have been little chance of doing so well on the
test. Thank you Kathy and Bert for a wonderful book!"
— Jon W. Kinsting (Saratoga, California United States)
"Don't hesitate to make this book your primary guide for SCJP 1.4 preparation. The
authors have made a marvellous job about delivering the vital facts you need to
know for the exam while leaving out tons of otherwise valuable data that fall beyond
the scope. Both authors have participated in creating the real questions for the real
exam thus providing an invaluable insight to discern the true nature of what you are
up to doing. Unlike many other certification guides…this one makes perfect reading.
The most boring Sun objectives in the book are nicely interwoven with the gems of
refreshingly spicy humor."
— Vad Fogel (Ontario, Canada)
Programmer for Java™
Programmer for Java™
New York Chicago San Francisco Lisbon London Madrid
Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto
McGraw-Hill is an independent entity from Sun Microsystems, Inc. and is
not afﬁliated with Sun Microsystems, Inc. in any manner.This publication and
CD may be used in assisting students to prepare for the Sun Certiﬁed Java
Programmer Exam. Neither Sun Microsystems nor McGraw-Hill warrants
that use of this publication and CD will ensure passing the relevant exam. Sun,
Sun Microsystems, and the Sun Logo are trademarks or registered trademarks
of Sun Microsystems, Inc. in the United States and other countries. Java
and all Java-based marks are trademarks or registered trademarks of Sun
Microsystems, Inc. in the United States and other countries.
We hope you enjoy this
McGraw-Hill eBook! If
you’d like more information about this book,
its author, or related books and websites,
please click here.
Want to learn more?
About the Authors
Kathy Sierra was a lead developer for the SCJP exam for Java 5 and Java 6. Sierra
worked as a Sun "master trainer," and in 1997, founded JavaRanch.com, the world's
largest Java community website. Her bestselling Java books have won multiple
Software Development Magazine awards, and she is a founding member of Sun's Java
Bert Bates was a lead developer for many of Sun's Java certification exams including
the SCJP for Java 5 and Java 6. He is also a forum moderator on JavaRanch.com, and
has been developing software for more than 20 years. Bert is the co-author of several
bestselling Java books, and he's a founding member of Sun's Java Champions program.
About theTechnical ReviewTeam
Johannes de Jong has been the leader of our technical review teams for ever and
ever. (He has more patience than any three people we know.) For this book, he led
our biggest team ever. Our sincere thanks go out to the following volunteers who
were knowledgeable, diligent, patient, and picky, picky, picky!
Rob Ross, Nicholas Cheung, Jane Griscti, Ilja Preuss, Vincent Brabant, Kudret
Serin, Bill Seipel, Jing Yi, Ginu Jacob George, Radiya, LuAnn Mazza, Anshu Mishra,
Anandhi Navaneethakrishnan, Didier Varon, Mary McCartney, Harsha Pherwani,
Abhishek Misra, and Suman Das.
LearnKey provides self-paced learning content and multimedia delivery solutions to
enhance personal skills and business productivity. LearnKey claims the largest library
of rich streaming-media training content that engages learners in dynamic media-rich
instruction complete with video clips, audio, full motion graphics, and animated
illustrations. LearnKey can be found on the Web at www.LearnKey.com.
Technical Review Superstars
We don't know who
burned the most midnight
oil, but we can (and did)
count everybody's edits—
so in order of most edits
made, we proudly present
Our top honors go to
time you see a semicolon
used correctly, tip your
hat to Kristin. Next up is
Burk Hufnagel who fixed
more code than we care
to admit. Bill Mietelski
and Gian Franco
Casula caught every
kind of error we threw
at them—awesome job,
guys! Devender Thareja
made sure we didn't use
too much slang, and Mark
Spritzler kept the humor
coming. Mikalai Zaikin
and Seema Manivannan
made great catches every
step of the way, and
Marilyn de Queiroz and
Valentin Crettaz both
put in another stellar
performance (saving our
butts yet again).
Marcelo Ortega, Jef Cumps (another veteran), Andrew Monkhouse, and Jeroen Sterken rounded
out our crew of superstars—thanks to you all. Jim Yingst was a member of the Sun exam creation
team, and he helped us write and review some of the twistier questions in the book (bwa-ha-ha-ha).
As always, every time you read a clean page, thank our reviewers, and if you do catch an error, it's
most certainly because your authors messed up. And oh, one last thanks to Johannes. You rule dude!
The Java 6 Elite ReviewTeam
Since the upgrade to
the Java 6 exam was
a like a small, surgical
strike we decided that
the technical review
team for this update
to the book needed to
be similarly fashioned.
To that end we hand-
picked an elite crew of
JavaRanch's top gurus
to perform the review
for the Java 6 exam.
Marc Peabody gets special kudos for helping us out on a double header! In addition to helping us
with Sun's new SCWCD exam, Marc pitched in with a great set of edits for this book—you saved our
bacon this winter Marc! (BTW, we didn't learn until late in the game that Marc, Bryan Basham, and
Bert all share a passion for ultimate Frisbee!)
Like several of our reviewers, not only does Fred Rosenberger volunteer copious amounts of his
time moderating at JavaRanch, he also found time to help us out with this book. Stacey and Olivia,
you have our thanks for loaning us Fred for a while.
Marc Weber moderates at some of JavaRanch's busiest forums. Marc knows his stuff, and
uncovered some really sneaky problems that were buried in the book. While we really appreciate
Marc's help, we need to warn you all to watch out—he's got a Phaser!
Finally, we send our thanks to Christophe Verre—if we can find him. It appears that Christophe
performs his JavaRanch moderation duties from various locations around the globe, including France,
Wales, and most recently Tokyo. On more than one occasion Christophe protected us from our own
lack of organization. Thanks for your patience, Christophe!
It's important to know that these guys all donated their reviewer honorariums to JavaRanch! The
JavaRanch community is in your debt.
Our endless gratitude goes to Mikalai
Zaikin. Mikalai played a huge role in
the Java 5 book, and he returned to
help us out again for this Java 6 edition.
We need to thank Volha, Anastasia,
and Daria for letting us borrow Mikalai.
His comments and edits helped us
make huge improvements to the book.
Kathy and Bert would like to thank the following people:
■ All the incredibly hard-working folks at McGraw-Hill: Tim Green, Jim Kussow,
Jody McKenzie, Madhu Bhardwaj, and Jennifer Housh for all their help, and
for being so responsive and patient—well, okay, not all that patient—but so
professional and the nicest group of people you could hope to work with.
■ To our saviors Solveig Haugland and Midori Batten, for coming to our rescue
when we were really in a bind!
■ Some of the software professionals and friends who helped us in the early
days: Tom Bender, Peter Loerincs, Craig Matthews, Dave Gustafson, Leonard
Coyne, Morgan Porter, and Mike Ka