1. Trang chủ
  2. » Công Nghệ Thông Tin

complete Java 2 certification

548 267 4

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 548
Dung lượng 8,75 MB

Nội dung

Complete Java 2 Certification Study Guide Fifth Edition Copyright ©2005 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com COPYING PROHIBITED © Copyright ©2005 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com COPYING PROHIBITED © Wiley Publishing, Inc. Complete Java ® 2 Certification Study Guide Fifth Edition Philip Heller Simon Roberts Copyright ©2005 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com COPYING PROHIBITED © Publisher: Neil Edde Acquisitions and Developmental Editor: Jeff Kellum Production Editor: Katherine Perry Technical Editor: James Nuzzi Copyeditor: Linda S. Recktenwald Compositor: Laurie Stewart, Happenstance Type-O-Rama Graphic Illustrator: Jeffrey Wilson, Happenstance Type-O-Rama CD Coordinator: Dan Mummert CD Technician: Kevin Ly Proofreaders: Jim Brook, Jennifer Larsen, Nancy Riddiough Indexer: Ted Laux Book Designer: Judy Fung Cover Designer: Archer Design Cover Illustrator/Photographer: Photodisk and Victor Arre Copyright © 2005 by Wiley Publishing, Inc., Indianapolis, Indiana First edition copyright © 1999 SYBEX, Inc. Second edition copyright © 2000 SYBEX, Inc. Third edition copyright © 2002 SYBEX, Inc. Fourth edition copyright © 2003 SYBEX, Inc. Library of Congress Card Number: 2005920774 ISBN-13: 978-0-7821-4419-2 ISBN-10: 0-7821-4419-5 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 Rose- wood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions. 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 per- mission. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. Screen reproductions produced with FullShot 99. FullShot 99 © 1991–1999 Inbit Incorporated. All rights reserved. FullShot is a trademark of Inbit Incorporated. The CD interface was created using Macromedia Director, © 1994, 1997–1999 Macromedia Inc. For more infor- mation on Macromedia and Macromedia Director, visit http://www.macromedia.com. The author and publisher have made their best efforts to prepare this book, and the content is based upon final release software whenever possible. Portions of the manuscript may be based upon pre-release versions supplied by software manufacturer(s). The author and the publisher make no representation or warranties of any kind with regard to the completeness or accuracy of the contents herein and accept no liability of any kind including but not limited to performance, merchantability, fitness for any particular purpose, or any losses or damages of any kind caused or alleged to be caused directly or indirectly from this book. Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 Copyright ©2005 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com COPYING PROHIBITED © To Our Valued Readers: Thank you for looking to Sybex for your Java certification exam prep needs. We at Sybex are proud of the reputation we’ve established for providing certification candidates with the prac- tical knowledge and skills needed to succeed in the highly competitive IT marketplace. The author, editors, and technical reviewers have worked hard to ensure that the updated fifth edition of the Complete Java 2 Certification Study Guide you hold in your hands is com- prehensive, in-depth, and pedagogically sound. We’re confident that this book will exceed the demanding standards of the certification marketplace and help you, the Java certification can- didate, succeed in your endeavors. As always, your feedback is important to us. If you believe you’ve identified an error in the book, please visit the Customer Support section of the Wiley web site. And if you have general comments or suggestions, feel free to drop me a line directly at nedde@wiley.com. At Sybex we’re continually striving to meet the needs of individuals preparing for certification exams. Good luck in pursuit of your Java certification! Neil Edde Publisher—Certification Sybex, Inc. Copyright ©2005 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com COPYING PROHIBITED © Wiley Publishing, Inc. End-User License Agreement READ THIS. You should carefully read these terms and conditions before opening the software packet(s) included with this book “Book”. This is a license agreement “Agreement” between you and Wiley Publishing, Inc. “WPI”. By opening the accompanying software packet(s), you acknowledge that you have read and accept the fol- lowing terms and conditions. If you do not agree and do not want to be bound by such terms and conditions, promptly return the Book and the unopened software packet(s) to the place you obtained them for a full refund. 1. License Grant. WPI grants to you (either an individual or entity) a nonexclusive license to use one copy of the enclosed software program(s) (collectively, the “Soft- ware,” solely for your own personal or business purposes on a single computer (whether a standard computer or a workstation component of a multi-user network). The Software is in use on a computer when it is loaded into temporary memory (RAM) or installed into permanent memory (hard disk, CD-ROM, or other storage device). WPI reserves all rights not expressly granted herein. 2. Ownership. WPI is the owner of all right, title, and interest, including copyright, in and to the compilation of the Software recorded on the physical packet included with this Book “Software Media”. Copyright to the indi- vidual programs recorded on the Software Media is owned by the author or other authorized copyright owner of each program. Ownership of the Software and all proprietary rights relating thereto remain with WPI and its licensers. 3. Restrictions On Use and Transfer. (a) You may only (i) make one copy of the Software for backup or archival purposes, or (ii) transfer the Software to a single hard disk, provided that you keep the original for backup or archival purposes. You may not (i) rent or lease the Software, (ii) copy or reproduce the Software through a LAN or other network system or through any computer subscriber system or bulletin-board system, or (iii) modify, adapt, or create derivative works based on the Software. (b) You may not reverse engineer, decompile, or disas- semble the Software. You may transfer the Software and user documentation on a permanent basis, provided that the transferee agrees to accept the terms and conditions of this Agreement and you retain no copies. If the Soft- ware is an update or has been updated, any transfer must include the most recent update and all prior versions. 4. Restrictions on Use of Individual Programs. You must follow the individual requirements and restrictions detailed for each individual program in the About the CD-ROM appendix of this Book or on the Software Media. These limitations are also contained in the indi- vidual license agreements recorded on the Software Media. These limitations may include a requirement that after using the program for a specified period of time, the user must pay a registration fee or discontinue use. By opening the Software packet(s), you will be agreeing to abide by the licenses and restrictions for these individual programs that are detailed in the About the CD-ROM appendix and/or on the Software Media. None of the material on this Software Media or listed in this Book may ever be redistributed, in original or modified form, for commercial purposes. 5. Limited Warranty. (a) WPI warrants that the Software and Software Media are free from defects in materials and workman- ship under normal use for a period of sixty (60) days from the date of purchase of this Book. If WPI receives notification within the warranty period of defects in materials or workmanship, WPI will replace the defec- tive Software Media. (b) WPI AND THE AUTHOR(S) OF THE BOOK DIS- CLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE SOFTWARE, THE PROGRAMS, THE SOURCE CODE CONTAINED THEREIN, AND/ OR THE TECHNIQUES DESCRIBED IN THIS BOOK. WPI DOES NOT WARRANT THAT THE FUNCTIONS CONTAINED IN THE SOFTWARE WILL MEET YOUR REQUIREMENTS OR THAT THE OPERA- TION OF THE SOFTWARE WILL BE ERROR FREE. (c) This limited warranty gives you specific legal rights, and you may have other rights that vary from jurisdiction to jurisdiction. 6. Remedies. (a) WPI’s entire liability and your exclusive remedy for defects in materials and workmanship shall be limited to replacement of the Software Media, which may be returned to WPI with a copy of your receipt at the follow- ing address: Software Media Fulfillment Department, Attn.: Complete Java 2 Certification Study Guide, 5e, Wiley Publishing, Inc., 10475 Crosspoint Blvd., India- napolis, IN 46256, or call 1-800-762-2974. Please allow four to six weeks for delivery. This Limited Warranty is void if failure of the Software Media has resulted from accident, abuse, or misapplication. Any replacement Software Media will be warranted for the remainder of the original warranty period or thirty (30) days, which- ever is longer. (b) In no event shall WPI or the author be liable for any damages whatsoever (including without limitation dam- ages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising from the use of or inability to use the Book or the Software, even if WPI has been advised of the possibility of such damages. (c) Because some jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation or exclusion may not apply to you. 7. U.S. Government Restricted Rights. Use, duplication, or disclosure of the Software for or on behalf of the United States of America, its agencies and/or instru- mentalities “U.S. Government” is subject to restric- tions as stated in paragraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause of DFARS 252.227-7013, or subparagraphs (c) (1) and (2) of the Commercial Computer Software - Restricted Rights clause at FAR 52.227-19, and in similar clauses in the NASA FAR supplement, as applicable. 8. General. This Agreement constitutes the entire under- standing of the parties and revokes and supersedes all prior agreements, oral or written, between them and may not be modified or amended except in a writing signed by both parties hereto that specifically refers to this Agreement. This Agreement shall take precedence over any other doc- uments that may be in conflict herewith. If any one or more provisions contained in this Agreement are held by any court or tribunal to be invalid, illegal, or otherwise unen- forceable, each and every other provision shall remain in full force and effect.held by any court or tribunal to be invalid, illegal, or otherwise unenforceable, each and every other provision shall remain in full force and effect. Copyright ©2005 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com COPYING PROHIBITED © To Keara: Two years ago, before we met, When you were only seven, I thought the blue that fills your eyes Was only found in heaven. What wonders will you gaze upon When my own eyes are fading, In forty years, when you’re as old As I was just this morning? —Love, Philip For my children, Emily and Bethan —Simon Copyright ©2005 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com COPYING PROHIBITED © Acknowledgments The authors would like to acknowledge the dedicated and talented people at Sybex who worked on this edition: Jeff Kellum, Katherine Perry, Linda Recktenwald, James Nuzzi, and the proofreaders, Jim Brook, Jennifer Larsen, Nancy Riddiough. Phil would like to express his gratitude to Simon Roberts and Bryan Basham. Also to all teachers, especially Carol, Gabriel, and Pantea. Copyright ©2005 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com COPYING PROHIBITED © Contents at a Glance Introduction xvii Assessment Test xxiii Chapter 1 Language Fundamentals 3 Chapter 2 Operators and Assignments 37 Chapter 3 Modifiers 71 Chapter 4 Converting and Casting 101 Chapter 5 Flow Control, Assertions, and Exception Handling 129 Chapter 6 Objects and Classes 167 Chapter 7 Threads 213 Chapter 8 The java.lang and java.util Packages 249 Chapter 9 I/O and Streams 311 Chapter 10 About the Developer’s Exam 349 Chapter 11 Swing Components 357 Chapter 12 Layout Managers 395 Chapter 13 Object Streams and RMI 435 Chapter 14 Putting It All Together 461 Appendix A Practice Exam 475 Glossary 499 Index 509 Copyright ©2005 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com COPYING PROHIBITED © Contents Introduction xvii Assessment Test xxiii Chapter 1 Language Fundamentals 3 Source Files 4 Keywords and Identifiers 5 Primitive Data Types 7 Literals 9 String Literals 11 Arrays 11 Importing 15 Class Fundamentals 19 Class Paths 19 The main() Method 19 Variables and Initialization 20 Argument Passing: By Reference or by Value 22 Garbage Collection 24 Summary 26 Exam Essentials 27 Review Questions 29 Answers to Review Questions 34 Chapter 2 Operators and Assignments 37 Overview of the Java Operators 38 Evaluation Order 39 The Unary Operators 40 The Increment and Decrement Operators: ++ and 40 The Unary Plus and Minus Operators: + and - 41 The Bitwise Inversion Operator: ~ 41 The Boolean Complement Operator: ! 41 The Cast Operator: (type) 42 The Arithmetic Operators 43 The Multiplication and Division Operators: * and / 43 The Modulo Operator: % 45 The Addition and Subtraction Operators: + and - 46 Arithmetic Error Conditions 48 Arithmetic Promotion of Operands 49 Copyright ©2005 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com COPYING PROHIBITED © [...]... Lists Sets Maps Copyright 20 05 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501 xiii 195 20 0 20 1 20 3 21 0 21 3 21 4 21 4 21 7 21 7 21 9 21 9 22 0 22 0 22 2 22 2 22 3 22 4 22 5 22 7 22 9 23 4 23 4 23 6 23 8 23 9 24 0 24 1 24 6 24 9 25 1 25 3 25 4 25 4 25 8 26 0 26 2 26 8 26 9 27 1 27 2 27 5 www.sybex.com © xiv COPYING PROHIBITED Contents Support Classes Collections and Code Maintenance Generic Collections Generics and the API Pages... Questions Chapter 10 About the Developer’s Exam 27 7 27 9 28 5 28 8 28 9 29 0 29 1 29 4 3 02 3 02 304 309 311 3 12 313 313 317 321 321 323 327 330 3 32 338 338 339 345 349 Are You Ready? Formalities of the Exam The Project Assignment The Essay Exam Grading Chapter 11 350 351 3 52 353 354 Swing Components 357 A Strategy for Designing the GUI Step 1: Identify Needed Components Step 2: Isolate Regions of Behavior Step 3: Sketch... The java. lang and java. util Packages The Object Class The Math Class Strings The String Class The StringBuffer and StringBuilder Classes String Concatenation the Easy Way The Wrapper Classes The Collections Framework The Collection Superinterface and Iteration Lists Sets Maps Copyright 20 05 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501 xiii 195 20 0 20 1 20 3 21 0 21 3 21 4 21 4 21 7 21 7 21 9 21 9... Invocation Remote References RMI Step by Step Summary Copyright 20 05 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501 xv 3 62 3 62 3 62 3 62 363 363 363 364 367 376 377 3 82 387 389 389 391 3 92 395 396 399 401 401 404 405 4 12 417 433 434 435 436 436 437 437 440 443 447 4 52 4 52 453 459 www.sybex.com © xvi COPYING PROHIBITED Contents Chapter 14 461 Javadoc Thread Issues Extra Credit RMI or Object Streams?... Specialized certifications are the best way to stand out from the crowd In this age of technology certifications, you will find hundreds of thousands of administrators who have successfully completed the Microsoft and Cisco certification tracks To set yourself apart from the crowd, you need a little bit more The Java Programmer Certification is the most basic Java certification and the Developer Certification. .. void main(String [] a) { int [] b = [1 ,2, 3,4,5,6,7,8,9,0]; System.out.println("a [2] =" + a [2] ); } } A The code compiles but does not output anything B “a [2] =3” is printed out to the console C “a [2] =2 is printed out to the console D The code does not compile E None of the above 12 What is the value of x after the following operation is performed? x = 23 % 4; A 23 B 4 C 5.3 D 3 E 5 13 Given the following... 30 = 1) Once this is completed, the final equation is executed as 32 * 1, which equals 32 See Chapter 2 for more information 21 A The StringBuilder class is compatible with StringBuffer but is not threadsafe and is generally faster See Chapter 8 for more information 22 D The sizes of the primitives are as follows: byte, 8 bits; char, 16 bits; short, 16 bits; int, 32 bits; float, 32 bits; long, 64 bits;... False 22 Select the list of primitives ordered in smallest to largest bit size representation A boolean, char, byte, double B byte, int, float, char C char, short, long, float D char, int, float, long E None of the above 23 Which class provides locale-sensitive text formatting for date and time information? A java. util.TimeFormat B java. util.DateFormat C java. text.TimeFormat D java. text.DateFormat 24 ... Conversion Object Method-Call Conversion Object Reference Casting Summary Exam Essentials Review Questions Answers to Review Questions Copyright 20 05 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501 49 101 1 02 103 103 107 108 109 1 12 1 12 115 115 120 120 121 127 www.sybex.com © xii COPYING PROHIBITED Contents Chapter 5 Flow Control, Assertions, and Exception Handling The Loop Constructs The while()... COPYING PROHIBITED Introduction We believe you’ll find this book particularly helpful because it was written by Java instructors and practitioners who have also taken part in the writing of the Java certification exams Why Become Java 2 Certified? There are a number of reasons for becoming Java 2 certified: It provides proof of professional achievement It increases your marketability It provides greater . written by Java instruc- tors and practitioners who have also taken part in the writing of the Java certification exams. Why Become Java 2 Certified? There are a number of reasons for becoming Java. and in-depth knowledge of programming Java. How to Become a Sun Certified Java Programmer for the Java 2 Platform 5.0 You can take the Sun Certified Java Programmer Exam whenever you like by. Sun Certified Java Developer for the Java 2 Platform 5.0 The Sun Certified Java Developer Exam costs $250. You aren’t allowed to register for this exam unless you are a certified Java programmer.

Ngày đăng: 20/10/2014, 19:05

TỪ KHÓA LIÊN QUAN

w