Senior Acquisitions Editor: Jeff Kellum
Development Editor: Kathi Duggan
Technical Editors: Dr. Ernest J. Friedman-Hill and Paul Nahay
Production Editor: Christine OConnor
Copy Editor: Judy Flynn
Editorial Manager: Pete Gaughan
Production Manager: Tim Tate
Vice President and Executive Group Publisher: Richard Swadley
Vice President and Publisher: Neil Edde
Book Designer: Happenstance Type-O-Rama
Compositors: Cody Gates, Craig Johnson, and Kate Kaminski, Happenstance Type-O-Rama
Proofreader: Candace English
Indexer: Nancy Guenther
Project Coordinator, Cover: Katherine Crocker
Cover Designer: Ryan Sneed
Cover Image: nullplus / iStockPhoto
Copyright 2013 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-1-118-35910-5
ISBN: 978-1-118-46385-7 (ebk.)
ISBN: 978-1-118-41695-2 (ebk.)
ISBN: 978-1-118-43409-3 (ebk.)
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: 2012947685
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. Java is a registered trademark 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.
10 9 8 7 6 5 4 3 2 1
Dear Reader,
Thank you for choosing Java SE 7 Programming Essentials. This book is part of a family of premium-quality Sybex books, all of which are written by outstanding authors who combine practical experience with a gift for teaching.
Sybex was founded in 1976. More than 30 years later, were still committed to producing consistently exceptional books. With each of our titles, were working hard to set a new standard for the industry. From the paper we print on, to the authors we work with, our goal is to bring you the best books available.
I hope you see all that reflected in these pages. Id be very interested to hear your comments and get your feedback on how were doing. Feel free to let me know what you think about this or any other Sybex book by sending me an email at . Customer feedback is critical to our efforts at Sybex.
Best regards,
Neil Edde
Vice President and Publisher
Sybex, an Imprint of Wiley
To Jocelyn, my love
Acknowledgments
Just hours before this writing, I received an email from Kathryn Duggan, this books development editor, saying the last chapter had now entered the pitiless, gaping maw of production. Let the grinding and forging begin. For this part of the process, I have to listen at a distance and make sense of the whirs and groans this material might force from the machine. I have to wonder what rough edges I missed that will now be cast in bronze, buffed into a high relief, and given prominence. What best parts will end up in some corner shadow or made to rest against the wall? I dont know. The wait is almost as hard as the writing.
What weve put into this book, though, is our combined best effort to oil that machine, a result of collaboration, faith, rerevising, and just a little lip biting. As this book goes into the mill, I am proud to have worked with every one of its contributors.
Kathi guided this project with an unfailingly positive spirit and saw it through more than one rough patch, all the while having to pick up and move several hundred miles, then find a house. Without her diligence, kind words, and tolerance for my sprint-and-coma style of submitting chapters, I am not sure Id have gotten this far, at least not in 2012. Thank you, Kathi; no one can expect the level of effort and encouragement you put into this book.
Ernest Friedman-Hill served as my technical editor, checking both the code and the rationale of the narrative for accuracy and consistency. You, good reader, will never again see such a bargain struck for a book of this sort. Ernest is an accomplished computer scientist, a professional of talents and abilities beyond my ken, an author in his own right, and a JavaRanch colleague whose work and contributions I have admired for over a decade. This book could have become a pale farce without his attention, his advice, and his drive on improving, well, everything. Yes, everything, right down to creating an alternate cover (which was ignored, sadly). I owe him big-time. I pledge here to pay his generosity forward. When you come across a section you think is especially sharp, Id be pleased if you remembered Ernest for it (too). Paul Nahay reviewed the manuscript and, so far as I could tell, observed each punctuation mark with suspicion. He uncovered error after error we somehow missed. These are errors an author might forgive as understandable lapses, but errors that a disinterested eye might view as a sign of wavering competence. It can be a thankless role, and Paul did it fearlessly. Thank you, Paul.
Next page