OCP
Oracle Certified Professional
Java SE 8 Programmer II
Study Guide
Jeanne Boyarsky
Scott Selikoff
Senior Acquisitions Editor: Kenyon Brown
Development Editor: Gary Schwartz
Technical Editors: Ernest Friedman-Hill and Matt Dalen
Production Editor: Dassi Zeidel
Copy Editor: Linda Recktenwald
Editorial Manager: Mary Beth Wakefield
Production Manager: Kathleen Wisor
Associate Publisher: Jim Minatel
Supervising Producer: Rich Graves
Book Designers: Judy Fung and Bill Gibson
Proofreader: Josh Chase, Word One New York
Indexer: Ted Laux
Project Coordinator, Cover: Brent Savage
Cover Designer: Wiley
Cover Image: Getty Images Inc./Jeremy Woodhouse
Copyright 2016 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-1-119-06790-0
ISBN: 978-1-119-06788-7 (ebk.)
ISBN: 978-1-119-06789-4 (ebk.)
Manufactured in the United States of America
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S. at (877) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2015951679
TRADEMARKS: Wiley, the Wiley logo, and the Sybex logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. Oracle and Java are registered trademarks of Oracle America, Inc. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
To the programmers on FIRST robotics team FRC 694 StuyPulse
Jeanne
To my newborn daughters Olivia and Sophia, I love you both more and more every day.
Scott
Acknowledgments
Jeanne and Scott would like to thank numerous individuals for their contribution to this book. Thank you, Gary Schwartz, for guiding us through the process and making the book better in so many ways. Thank you, Ernest Friedman-Hill, for being our Technical Editor as we wrote this book. Ernest pointed out many subtle errors in addition to the big ones. And thank you, Matt Dalen, for being our Technical Proofreader and finding the errors that managed to sneak by even Ernest. This book also wouldn't be possible without many people at Wiley, including Kenyon Brown, Dassi Zeidel, Mary Beth Wakefield, and so many others.
Jeanne would personally like to thank Chris Kreussling and Elena Felder for their feedback on early drafts of the trickier material. Elena even helped figure out a good way to explain upper bounds. Roel De Nijs reviewed the Java 8 date/time material for words that native English speakers take for granted, and he responded to lots of posts in the CodeRanch.com OCA forum on our first book. To all of the people at work and at CodeRanch.com who were so excited for me about writing this book, you made it even more exciting when we published our first book. Jeanne would like to thank the members of FIRST robotics FRC team 694 for their support. It was an awesome feeling seeing high school students pore over the book while waiting for dinner the night the hard copy arrived. Go StuyPulse! See if you can find JoeBot in this book. Finally, Jeanne would like to thank Scott for being a great co-author again.
Scott could not have reached this point without the help of a small army of people, led by his perpetually understanding wife Patti, the most wonderful mother their twin daughters could ask for. Professor Johannes Gehrke of Cornell University always believed in him and knew he would excel in his career. Jeanne's patience and striving for excellence was invaluable in creating this second book. A big thanks to fellow new father Matt Dalen, who has been a wonderful friend, sounding board, and technical reviewer over the last year. Joel McNary introduced Scott to CodeRanch.com and encouraged him to post regularlya step that changed his life. Finally, Scott would like to thank his mother and retired teacher Barbara Selikoff, for teaching him the value of education, and his father Mark Selikoff, for instilling in him the benefits of working hard.
Finally, both Jeanne and Scott would like to give a big thank-you to the readers of our OCA 8 book. Hearing from all of you who enjoyed the book and passed the exam was great. We'd also like to thank those who pointed out errors and made suggestions for improvements in our OCA book. As of July 2015, the top three were Mushfiq Mammadov, Elena Felder, and Cdric Georges. Thank you for your attention to detail! We also would like to thank Mathias Bader, Maaike Zijderveld, Vincent Botteman, Edward Rance, Gabriel Jesus, Ilya Danilov, Marc ter Braak, Dominik Bauer, Saad Benbouzid, Evgeny Kapinos, Helen Colson, Alex Lord, and Kevin Abel.
Next page