ebook img

SCJA Sun Certified Java Associate Study Guide (Exam CX-310-019) (Certification Press) PDF

405 Pages·2009·2.94 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview SCJA Sun Certified Java Associate Study Guide (Exam CX-310-019) (Certification Press)

SCJA Sun® Certified Java™ Associate Study Guide (Exam CX-310-019) Robert Liguori Edward Finegan McGraw-Hill is an independent entity from Sun Microsystems, Inc. and is not affiliated with Sun Microsystems, Inc. in any manner. This publication and CD may be used in assisting students to prepare for a Sun Certified Java Associate 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. New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto Copyright © 2010 by The McGraw-Hill Companies. All rights reserved. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher. ISBN: 978-0-07-159484-4 MHID: 0-07-159484-1 The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-149003-0, MHID: 0-07-149003-5. All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps. McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. To contact a representative please e-mail us at [email protected]. Information has been obtained by McGraw-Hill from sources believed to be reliable. However, because of the possibility of human or mechan- ical error by our sources, McGraw-Hill, or others, McGraw-Hill does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information. Sun, Sun Microsystems, the Sun Logo, SCJA, SCJP, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. TERMS OF USE This is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGraw-Hill”) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill’s prior consent. You may use the work for your own non- commercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms. THE WORK IS PROVIDED “AS IS.” McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw- Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise. Disclaimer: This eBook does not include the ancillary media that was packaged with the original printed version of the book. About the Authors Robert Liguori is a Senior Software Engineer and has been developing, maintaining, and testing air traffic management systems since 1996. He is currently architecting, designing, developing, and maintaining Java EE E-business systems and Java-based air traffic management systems. Mr. Liguori is a Senior Software Engineer with MetaTec Group, Inc. Mr. Liguori has a bachelor’s degree in computer science and information technology from Richard Stockton College of New Jersey. He is the founder and president of the Atlantic City Java User Group (ACJUG) supporting the southern New Jersey area (http://acjug.dev.java.net). He is a Sun Certified Java Associate (SCJA) and Sun Certified Java Programmer (SCJP) and is currently pursuing various other Sun certifications. For the better part of 2007, Mr. Liguori spent his free time with his wife co-authoring a handy Java reference guide: Java Pocket Guide, by Robert and Patricia Liguori (O’Reilly Media Inc., 2008). It succeeded in capturing Java’s fundamentals in a companion-size book. Mr. Liguori enjoys spending time with his family, as well as surf fishing for striped bass and red drum along the East Coast of the United States. He can be contacted at [email protected]. Edward Finegan is a Senior Java Software Developer and is currently working in the casino gaming industry where he designs and implements software for gaming machines. He has previous experience in air traffic management systems and radar protocols. Mr. Finegan has a bachelor’s degree in computer science from Rowan University, and a master’s degree in computer science from Virginia Commonwealth University. His thesis was entitled Intelligent Autonomous Data Categorization, which examined the possibility of using machine-learning algorithms to intelligently and autonomously categorize data. He is also a Sun Certified Java Professional. Mr. Finegan is an avid Philadelphia sports fan. He enjoys outdoor activities and home-improvement projects, as well as tinkering with the latest technologies. He can be contacted at [email protected]. About the technical editor Alistair Grieve started his career as a Tandem NonStop COBOL programmer. Since then, he has worked for more than 20 years as a software developer and database administrator, primarily in the financial services sector, in the UK, the U.S.A., and New Zealand. He is also a freelance technical editor. Mr. Grieve is an engineering science graduate of the University of Oxford. He is a Sun Certified Java Programmer (SCJP) and Web Component Developer (SCWCD), as well as an Oracle Certified Professional (OCP) database administrator. He can be contacted at [email protected]. About LearnKey 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. To Dad, Mom, Michael, Patti Ann, Ashleigh, Joseph, Kara and Tristan —Robert J. Liguori To my soon-to-be-wife Shannon for having ample patience during this endeavor and to my Mom and Dad for their ongoing support. —Edward G. Finegan This page intentionally left blank Contents At A GLAnCe Part I Fundamental Java Elements 1 Packaging, Compiling, and Interpreting Java Code . . . . . . . . . . . . . . 3 2 Programming with Java Statements . . . . . . . . . . . . . . . . . . . . . . . . . 41 3 Programming with Java Operators and Strings . . . . . . . . . . . . . . . . . 81 Part II Object-Oriented Basic Concepts 4 Working with Basic Classes and Variables . . . . . . . . . . . . . . . . . . . . 129 5 Understanding Variable Scope and Class Construction . . . . . . . . . . . 161 6 Working with Classes and Their Relationships . . . . . . . . . . . . . . . . . 187 7 Understanding Class Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 8 Understanding Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 9 Representing Object-Oriented Concepts with UML . . . . . . . . . . . . . 289 Part III Java-Related Platforms and Technologies 10 Understanding Java-Related Platforms and Integration Technologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 11 Understanding Client-Side Technologies . . . . . . . . . . . . . . . . . . . . . 359 12 Understanding Server-Side Technologies . . . . . . . . . . . . . . . . . . . . . 387 vii viii SCJA Sun Certified Java Associate Study Guide Part IV Appendixes A About the CD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 B Exam-Related Packages and Classes . . . . . . . . . . . . . . . . . . . . . . . . . 425 C Unicode Standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 D Bracket Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 Contents Acknowledgments ................................................. xvii Preface ......................................................................... xix Introduction ................................................................... xxv Part I Fundamental Java elements 1 Packaging, Compiling, and Interpreting Java Code .... 3 Understanding Packages .................................................... 4 Package Design ..................................................... 5 package and import Statements .............................. 6 exercise 1-1: Replacing Implicit import Statements with Explicit import Statements ............................ 9 Understanding Package-Derived Classes .................................. 11 Java Utilities API .................................................. 12 Java Basic Input/Output API ..................................... 14 The Java Networking API ........................................ 14 Java Abstract Window Toolkit API .............................. 15 Java Swing API .................................................... 15 exercise 1-2: Understanding Extended Functionality of the Java Utilities API ....................................... 17 Compiling and Interpreting Java Code .................................... 19 Java Compiler ...................................................... 19 Java Interpreter ..................................................... 22 exercise 1-3: Compiling and Interpreting Packaged Software .............................................. 26 3 Two-Minute Drill .................................................. 29 Q&A Self Test ............................................................. 31 Self Test Answers .................................................. 34 ix x SCJA Sun Certified Java Associate Study Guide 2 Programming with Java statements ..................... 41 Understanding Fundamental Statements .................................. 43 Assignment Statements ........................................... 44 Conditional Statements ........................................... 46 Iteration Statements ............................................... 54 exercise 2-1: Iterating Through an ArrayList While Applying Conditions ................................... 58 exercise 2-2: Performing Code Refactoring .................. 60 Implementing Statement-Related Algorithms from Pseudo-code ...... 61 Pseudo-code Algorithms .......................................... 62 exercise 2-3: Knowing Your Statement-Related Keywords ........................................................ 63 Pseudo-code Algorithms and Java ................................ 65 exercise 2-4: Implementing Pseudo-code Algorithm #1 .... 66 exercise 2-5: Implementing Pseudo-code Algorithm #2 .... 66 exercise 2-6: Implementing Pseudo-code Algorithm #3 .... 67 3 Two-Minute Drill .................................................. 68 Q&A Self Test ............................................................. 70 Self Test Answers .................................................. 74 3 Programming with Java operators and strings ........ 81 Understanding Fundamental Operators ................................... 82 Assignment Operators ............................................. 84 exercise 3-1: Using Compound Assignment Operators ..... 85 Arithmetic Operators .............................................. 87 Relational Operators ............................................... 89 Logical Operators .................................................. 92 Developing with String Objects and Their Methods ..................... 95 Strings ............................................................... 95 The String Concatenation Operator ............................. 97 exercise 3-2: Uncovering Bugs that Your Compiler May Not Find ....................................... 100 Methods of the String Class .................................... 101 3 Two-Minute Drill .................................................. 109 Q&A Self Test ............................................................. 112 Self Test Answers .................................................. 118

Description:
I would have to agree with others regarding the example questions. Numerous times in the examples does it give a wrong answer, or the list of possible answers within the answer section does not match the actual question it asks. While this is very annoying, it did force me to look into / better unde
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.