SUN认证培训资料SCJP
SUN认证培训资料SCJP。Table of contentsJava 2 Certification Training Guide-4Introduction -6Part iBecoming a Sun Certified Java 2 ProgrammerChapter 1-Overview of the Java Programmer Exam -9Chapter 2 -Language Fundamentals-15Chapter -Operators and Assignments-31Chapter 4 -Declarations and Access Control-60Chapter 5 -Flow Control and Exception Handling-74chapter 6 O1g, Runtime Type, and objectOrientation-95Chapter7 -Garbage Collection -114Chapter 8- Threads-122hapter g- the java lang package -145Chapter 10-The java util Package-158Chapter 11- The java. awt Package: Components and Facilities -177Chapter 12- The java. awt Package: Layout -204Chapter 13-The java. awt Package: Event Handling -219Chapter 14-The java. awt Package: Painting -238Chapter 15- The java. o Package -257Part IIBecoming a sun Certified Java 2 ArchitecChapter 16-Overview of the Java architect Exam-285Chapter 17-Java Applications Architecture-289Chapter 18-Object-Oriented Architecture Design -300Chapter 19-Distributed Applications Technologies -314Chapter 20-Securing Distributed Applications-337Chapter 21 -Working with Legacy Systems-354Part III Becoming a Sun Certified Java 2 DeveloperChapter 22-Overview of the Java developer Exam -368Chapter 23- The Programming Assignment-373Chapter 24-The Essay Exam-379I AppendixesAppendix A-Running the Simulated Exam Program -385Appendix B-Running the Simulated Preparation Program-390IndexList of FiguresList of tablesList of listingsList of sidebarsBack CoverOne of the best ways for a Java programmer to stand out from the crowd is tobecome a Sun Certified Java Programmer, Developer, or Architect. This bookhelps Java developers prepare for all three certification exams. One of thestrengths of this book is that it is extremely focused--it doesn t containextraneous information, a history of Java, or background on relatedtechnologies. This book gives readers exactly what they need to pass theexams. This book also contains a uniques test engine(written in Java by theauthor)to help readers assess their skills and become confident with thestructure of the examsAbout the authorJamie Jaworski is a professional Java developer and Sun-certified Javaprogrammer, developer, and architect who works for the U.S. Department ofDefense. Mr. jaworski has been a java consultant to sun and has writtenseveral best-selling books on Java and JavaScript, including Java2 PlatformUnleashed and Mastering JavaScript and JScript. He also writes theSuperScripter column for CNEt's popular Web site for WebmastersBuilder.comJava 2 Certification Training GuideJamie JaworskiCopyright 1999 by New Riders PublishinglI rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmittedherein.Although every precaution has been taken in the preparation of this book, the publisher ang oonby any means, electronic, mechanical, photocopying, recording, or otherwise, without written permissionfrom the publisher. No patent liability is assumed with respect to the use of the information containeauthor assume no responsibility for errors or omissions. Neither is any liability assumed for damagesresulting from the use of the information contained hereinInternational Standard book number: 1-56205-950-5Library of Congress Catalog card Number: 99-63309TrademarksAll terms mentioned in this book that are known to be trademarks or service marks have beenappropriately capitalized. New Riders Publishing cannot attest to the accuracy of this information. Useof a term in this book should not be regarded as affecting the validity of any trademark or service markJava, HotJava, JavaBeans, Sun, and Sun Microsystems are trademarks of Sun microsystems, IncWarning and DisclaimerEvery effort has been made to make this book as complete and as accurate as possible, but nowarranty or fitness is implied The information provided is on an as is" basis. The authors and thepublisher shall have neither liability nor responsibility to any person or entity with respect to any loss ordamages arising from the information contained in this book or from the use of the CD or programsaccompanying itExecutive editorTim RyanDevelopment editorJon steeverManaging EditorJodi jensenSenior editor4Susan ross mooreCopy EditorMary LaguIndexerCheryl LandesProofreaderMona brownTechnical editorAlexandre calsavaraSoftware Development specialistBill elandInterior DesignNathan clementCover DesignSandra schroederCopy WriterEric BorgertLayout techniciansBrian bordersSusan geiselmanMark WalchleAbout the authorJamie JaworskiJamie Jaworski is a professional Java developer and Sun certified Java programmer, developer, andarchitect who works for the U.s. Department of Defense. Mr. Jaworski has been a Java consultant toSun and has written several best-selling books on Java and JavaScript, including Java 2 PlatformUn/ea shed and Mastering Java Script and Script. He also writes the Super Scripter column for CNET'spopular Web site for Webmasters, Builder, corDedicationThis book is dedicated to my lovely wife, Lisa JaworskiAcknowledgmentsI'd like to thank everyone who helped to see this book to completion. In particular, I'd like to thank MargoMaley Hutchison of Waterside Productions for making the book possible; Tim Ryan, Jon Steever, SusanMoore, Mary Lagu, and Katie Robinson of Macmillan Computer Publishing for their numeroussuggestions that improved the overall quality of the book; and Alexandre Calsavara for his excellentechnical input. Alexandre's keen technical insights made this a better book. Id also like to thankGeorge Stones for helping with the book's Web site and for providing online support for this bookFinally, Id like to thank Lisa, Jason, and Emily for their patience, love, and understandingTell us what you thinkAs the reader of this book, you are our most important critic and commentator. We value your opinionand want to know what we're doing right, what we could do better, what areas you' d like to see uspublish in, and any other words of wisdom you're willing to pass our wayAs an Executive Editor for New Riders, I welcome your comments. You can fax, email, or write medirectly to let me know what you did or didn 't like about this book--as well as what we can do to makeour books strongerWhen you write, please be sure to include this book,'s title and author as well as your name and phoneor fax number. I will carefully review your comments and share them with the author and editors whoworked on the bookFax:317581-4770email:avadmcp.comMailTim RyanMacmillanComputerPublishe201 West 103rdStreetIndianapolis, IN46290USAIntroductionJava 2 CertificationIn just a few years, Java has become one of the world's most popular programming languages. Java'sinitial popularity stemmed from its association with the Web and its capability to deliver executablecontent to Web pages. This popularity increased as programmers discovered Java's power, simplicity,and rich APIs. Java's popularity increased further as both large and small companies invested inbuilding Java-based information infrastructuresOne of the results of Java's popularity is that there is a high demand for skilled Java programmers andsystem architects. However, due to Javas brief existence, experienced Java programmers are hard tofind. Hardly anyone in the field has more than a few years experience in developing Java applicationsThis is a problem for both employers and programmers. Employers cannot rely on the traditionanumber of years of experience in selecting senior-level Java programmers and software engineers. StarJava programmers have a hard time differentiating themselves from entry-level Java programmersThe Java certification exams provide a solution for both employers and programmers. Employers canidentify skilled Java programmers by their certification level. Programmers and software engineers canattest to their knowledge of java by pointing to their certification credentialsThe Java certification program is not new-it has been around since version 1.02 of the JavaDeveloper's Kit. However, a new certification exam-the Java architect exam -was introduced withJaya 2 the differences between the three exams are as followsProgrammer examThe Programmer exam tests the candidate's knowledge of the Javalanguage and basic API packages. Programmer certification is a prerequisite to DevelopercertificationDeveloper exam-The Developer exam tests the candidate's ability to complete an extendedprogramming assignment and answer questions concerning the issues and tradeoffs involved inthe assignments completionArchitect exam-The Architect exam tests a candidate's familiarity with the technologies usedto build Java-based enterprise applications and the candidate's ability to resolve issues in Javaapplication design. This exam focuses on much higher-level software and system engineeringskills than the Programmer and Developer examsBeing a Java evangelist since its initial alpha release in 1995 and having written several books on JavI was intrigued about how Sun would go about testing programmers. When I finally took the JDK 1.1Programmer's exam back in 1998, I was amazed at the great job that sun's testers had done atselecting a challenging and highly appropriate set of questions for the test. When I was invited inDecember of 1998 to visit Sun s broomfield colorado campus to select the questions for the java 2Programmer's exam, I jumped at the chance. Since then, I've been actively involved in all aspects ofJava certification, taking and passing each of the three exams and developing an online training coursefor DigitalThink. I am confident that this book will help you in your quest to attain Java certification, nomatter which certification exam you takeAttaining Java certification is not easy. The most basic certification exam the Programmer exam is verydifficult, even for an experienced Java programmer. This exam covers every aspect of the Javalanguage and many of the core classes and interfaces of the basic aPI packages In order to pass thisexam you must acquire both a breadth and depth of experience with the Java language and selectedAPI packages. This book is organized to help you to prepare for the Programmer, Architect, andDeveloper exams as followsPart l of this book is dedicated to the programmer exam and is organized according to Sunspublished exam topics and objectives. It contains a detailed and focused description of the topicsthat are covered by the exam, numerous questions that review your understanding of thesetopics, and even more questions that you can use to measure your progress and determine whenyou're ready to take the exam.Part I prepares you for the Java Architect exam. It introduces the technologies that are coveredby the exam and describes the issues and tradeoffs involved in building Java-based distributedapplications. It also provides review and sample exam questions that you can use to assess yourmastery of the exam topicsPart I covers the Java Developer exam. It provides you with background information on whatto expect and provides a number of tips that will help you to successfully complete yourassignment. The essay part of the Developer exam is also covered. Approaches to preparing forand answering the essay questions are described. Sample exam questions are examined andanswers to these questions are providedWho should read this bookThis book is for anyone who wants to take and pass any of the three Java 2 Platform certificationexams. If you are an experienced Java programmer and you want to pass the Programmer exam, thisbook will show you how. It will fill any gaps that you might have in your knowledge of the Java languageor fundamental API packages. It will cover all that you need to know to do well on the exam and helpyou to assess your test readiness through hundreds of review and sample exam questions. If you studythe material presented in each chapter, use the review questions to identify areas that you need toimprove in, and continue your study until you get high grades in the sample exam questions. Then you'llbe on a direct path to passing the examIf you are not an experienced Java programmer, you'll need to learn how to program in Java beforetaking the Programmer exam. I suggest that you start with Suns online Java tutorial athttp://www.javasoft.com/dccs/books/tutorial/index.htmlandworkyourwaythroughan intermediate to advanced java book such as java 1.2 Un/eashedIf you are an experienced software or system engineer and you want to take and pass the JavaArchitect exam, this book will point you to the information that you need to know in order to pass theexam. While you want be an experienced architect after reading six chapters, you will have covered theArchitect exam topics and learned about the salient issues faced by the architects of Java-basedapplications. Moreover, the review and exam questions of these chapters will help you to determinehether you need more study or are ready to take the exam you don 't need to take the javaProgrammer exam to take the Java Architect exam. However, as you can probably guess, knowledge ofJava programming is extremely helpful for anyone who wants to design Java-based applicationsIf you successfully pass the Java Programmer exam, you may want to achieve a higher level ofcertification by taking and passing the Java Developer exam. The Java Developer exam is a two-partexam that consists of a programming assignment and an essay exam. the programming assignmentrequires you to complete a partially developed Java application according to a list of very specificinstructions. The essay exam consists of a small number (5-10)of short-answer essay questions. Inorder to take the Java Developer exam you must take and pass the Programmer exam. If you haven ' ttaken the Programmer exam, then you should definitely start with that. Don 't worry about the Developerexam until you have the Programmer exam under your belt. Once you've taken the Programmer exam, Irecommend that you take (or at least study for) the Architect exam. The object-oriented designprinciples that you cover in preparing for the architect exam will help you to do better on theprogramming assignment part of the Developer exam and also help you to answer the essay questionswith a better understanding of the design tradeoffs they addressGetting StartedTo use this book, you' ll need a computer and operating system that support the Java 2 Platform. Thereare a wide variety of operating systems that support the Java 2 Platform, including Windows 2000, NT98, and 95, Linux, and Solaris. Ports of the Java 2 Platform to many other operating systems are in theworks. The examples used in this book were developed under windows 98. However, they are pureJava and will run under all Java 2 Platform implementations7The CD-Rom that accompanies this book contains all the source and compiled code for all examplespresented in this book. the CD-ROM is a hybrid that works on Windows, Linux, UNIX, and macintoshplatforms. In addition, it contains an Exam Preparation program that helps you to review the materialpresented in each chapter and a simulated Exam program that tests your knowledge of this materialAppendixes a and b show you how to install and run these programsHow to Use This bookNo matter which exam you are studying for, I recommend that you start with Chapter 1 and proceedthrough each chapter of the book in order, working through all review and exam questions Passing theProgrammer exam is a prerequisite to taking the Developer exam. However, I believe that the refinedunderstanding of the Java language and basic API that you need to pass the Programmer exam is alsoan important asset to a Java Architect. I also believe that the object-oriented software engineering skillsthat you need to pass the Java Architect exam will help you to do better on the Java Developer examConventions Used in this bookThis book follows certain conventions that make it easier for you to useList of objectives--Each chapter begins with a list of objectives that identify areas youshould focus on in studying the material presented in the chapterChapter Outline-The chapter's outline is presented after the list of objectives, enabling youto get a quick overview of the chapter's organizationStudy Strategies--Study strategies that identify ways to prepare for the certification examare provided, following the chapter outlineChapter Introduction/Summary--In order for you to understand where you are going andwhere you have been, each chapter begins with a short description of the information thatwill be presented and ends with a summary of the material that was coveredKey Terms-A list of key terms are provided at the end of each chapter. You should revieweach term and make sure that you are familiar with how the term applies to the material thatyou studied in the chapter.Review Questions--Review questions are short-answer questions that test yourcomprehension of the material that was presented in the chapter I recommend that youwrite down your answers to these questions to increase your retention of the informationyou've studiedExam Questions--Exam questions are multiple-choice questions that are modeled afterquestions that appear in the certification exams. These questions are used to test yourknowledge of the material covered in the chapter and determine whether you need furtherstudy before going on to the next chapter or taking the certification examAnswers and Explanations-The answers to each of the review and exam questions areprovided along with short explanations as to why each answer is correctSuggested Readings and Resources--Each chapter ends with a reference to additionalinformation that you can use to learn more about the information that you just studiedA monospaced font is used to identify program code. An italic monospaced font is used toidentify any placeholders used in Java syntax descriptionsIn addition, the following visual cues will help draw your attention to important informationNoteNotes like this are used to call your attention to information that is important tounderstanding and using Java or doing well on the certification examsTipTips like this are used to identify ways that you can use Java more efficiently orprepare yourself for the certification examsWarningWarnings like this are used to help you to avoid common problemsencountered when using Java and when answering exam questions8The book's web siteTo help you with your certification studies, Ive put together a Java certification Web site thatsupplements the information presented in this book. It provides a forum for feedback on the certificationexams and contains any corrections for errors that are discovered after the book's printing. The URL forthisWebsiteishttp://www.jaworski.com/java/certification/.Ifyouhaveanyquestionscomments, or suggestions concerning the book, its Web site, or the certification exams, please directthem to support@jaworski. ccImPart Becoming a Sun Certified Java 2 ProgrammerChapter ListChapter 1: Overview of the Java Programmer EXamhapter 2: Language FundamentalsChapter 3: Operators and AssignmentsChapter 4: Declarations and Access ControlChapter 5: Flow Control and Exception HandlingChapter 6: Overloading, Overriding, Runtime Type, and Object OrientationChapter 7: Garbage CollectionChapter 8: ThreadsChapter 9: The java. lang PackageChapter 10: The java util PackageChapter 11: The java. awt Package: Components and FacilitiesChapter 12: The java. awt Package: LayoutChapter 13: The java. awt Package: Event HandlingChapter 14: The java. awt Package: PaintingChapter 15: The java. io PackageChapter 1: Overview of the Java Programmer ExamObjectivesThis chapter helps you to prepare for the exam by covering the following objectivesKnow what topics are covered in the certification exam and what technologies are addressed bythese topicsThe skills required to pass the Java 2 programmer certification exam are many. You must befamiliar with all aspects of the Java programming language. You must be familiar with thecore packages of the Java 2 APl. You must also be able to write both console and AWtprograms. These areas cover a very wide range of potential topics. By knowing the exacttopics covered by the exam, you'll be able to focus on sharpening the programming skillsyou need to pass the examKnow how the exam is givenThe more that you know about the certification exam before going in to take it, the fewersurprises you'll have, and the better off you'll beKnow how to prepare for the certification examGiven limited time and resources, you'll want to get the best return for the time that you putinto studying. This chapter will give you study tips that can help you to maximize the benefitsof your study effortsKnow how to take the certification examSome people take tests better than others. This doesn't necessarily mean that they aresmarter or better prepared. Sometimes it means that they use a better test-taking approachThis chapter covers a test-taking approach that can help you improve your overall examscoreChapter IntroductionThis chapter introduces you to the Sun Certified Programmer for Java 2 Platform Examination. Itidentifies the topics that the exam covers, discusses how the exam is given, and provides you with tipsand other information on how to take the examThis chapter kicks off Part l of this book Part l prepares you with the information that you need to passthe Java 2 programmer certification exam although all the information is covered some information ismore important than the rest. By reading this chapter carefully before going on to other chapters in PartL, you'll have a better feel for the information to focus on in order to successfully pass the examWhat the Exam CoversThe Java 2 programmer exam covers a wide range of topics related to the Java programming languagecore API packages, and console and AWT program development. It contains 59 questions onorganized according to the following topics(supplied by Sun/ expected to know. These questions areprogramming topics that a well-versed Java programmer is beDeclarations and Access controlWrite code that declares constructs and initializes arrays of any base typeusing any of the permitted forms both for declaration and for initializationDeclare classes. inner classes, methods, instance variables, staticvariables, and automatic(method local) variables, making appropriate useof all permitted modifiers(such as public, final, static, abstract: andso forth) State the significance of each of these modifiers, both singly and incombination, and state the effect of package relationships on declared itemsqualified by these modifiersFor a given class, determine if a default constructor will be created, and if so,state the prototype of that constructorState the legal return types for any method, given the declarations of allrelated methods in this or the parent classes2. Flow Control and Exception HandlingWrite code using i f and switch statements, and identify legal argumenttypes for these statementsWrite code using all forms of loops, including labeled and unlabeled use ofreak and continae and state the values taken by loop counter variablesduring and after loop executionWrite code that makes proper use of exceptions and exception-handlingclauses (trv, catch, finally) and declares methods and overridingmethods that throw exceptions3. Garbage CollectionState the behavior that is guaranteed by the garbage collection system andwrite code that explicitly makes objects eligible for collection4. Language FundamentalsIdentify correctly constructed package declarations, import statements classdeclarations(of all forms including inner classes), interface declarations, andmplementations (for java. lang Runnable or other interface described inthe test), method declarations(including the main() method that is used tostart execution of a class), variable declarations, and identifiersState the correspondence between index values in the argument arraypassed to a main method and command-line argumentslentify all Java programming language keywordState the effect of using a variable or array element of any kind when noexplicit assignment has been made to itState the range of all primitive data types, and declare literal values forString and all primitive types, using all permitted formats bases andrepresentationsWrite code to implement listener classes and methods, and in listenermethods, extract information from the event to determine the affectedcomponent, mouse position, nature, and time of the event. state the eventclass name for any specified event listener interface in the java.awteventpackage5. Operators and Assignments10
下载地址
用户评论