In This Book

This book is organized in such a way as to serve as an in-depth review for the Sun Certified Programmer for the Java 2 Platform 1.4 , 0 exam for both experienced Java professionals and those in the earlier stages of experience with Java technologies. Each chapter covers a major aspect of the exam, with an emphasis on the “why” as well as the “how to” of  programming in the Java language. The book also includes an in-depth review of the essential ingredients for a successful assessment of a project submitted for the Sun Certified Java Developer exam.

 

What This Book is Not

 

You will not find a beginner's guide to learning Java in this book. All 700+ pages of this book are dedicated solely to helping you pass the exams. If you are brand new to Java, we suggest you spend a little time learning the basics, and should not start with this book until you know how to write, compile, and run simple Java programs. We do not, however, assume any level of prior knowledge of the individual topics covered. In other words, for any given topic (driven exclusively by the actual exam objectives), we start from the assumption that you are new to that topic. So we assume you’re new to the individual topics, but we assume that you are not new to Java.

   We also do not pretend to be both preparing you for the exam and simultaneously making you a complete Java being. This is a certification exam study guide, and it’s very clear about its mission. That’s not to say that preparing for the exam won't help you become a better Java programmer! On the contrary, even the most experienced Java developer often claims that having to prepare for the certification exam made him a far more knowledgeable and well-rounded programmer than he would have been without the exam-driven studying.

 

On the CD

For more information on the CD-ROM, please see Appendix A.

 

In Every Chapter

In the Programmers'’ Exam section of the book, (Part I), we've created a set of chapter components that call your attention to important items, reinforce important points, and provide helpful exam-taking hints. Take a look at what you'll find in every chapter:

 

·          Every chapter begins with the Certification Objectives—what you need to know in order to pass the section on the exam dealing with the chapter topic. The Objective headings identify the objectives within the chapter, so you'll always know an objective when you see it!

 

·         Exam Watch notes call attention to information about, and potential pitfalls in, the exam. These helpful hints are written by authors who have taken the exams and received their certification - who better to tell you what to worry about? They know what you're about to go through!

 

·         Practice Exercises are interspersed throughout the chapters. These are step-by-step exercises that allow you to get the hands-on experience you need in order to pass the exams. They help you master skills that are likely to be an area of focus on the exam. Don’t just read through the exercises! They provide hands-on practice you should be comfortable completing. Learning by doing is an effective way to increase your competency.

 

·         On the Job notes describe the issues that come up most often in real-world settings. They provide a valuable perspective on certification-related topics. They point out the common mistakes and address questions that have arisen from on the job discussions and experience.

 

·         From the Classrooms describe the issues that come up most often in the training classroom settings. These sidebars highlight some of the most common and confusing problems that students encounter when taking a live Java training course. You can get a leg up on  those difficult-to-understand subjects by focussing extra attention on these sidebars.


·         Scenario and Solutions sections lay out potential problems and solutions in a quick-to-read format:

             

                                    SCENARIO & SOLUTION

What benefits do you gain from encapsulation?

Ease of code maintenance, extensibility, and code

clarity

What is the object-oriented relationship between a tree and an oak ?

An IS-A relationship: Oak IS-A Tree.

What is the object-oriented relationship between a city and a road ?

A HAS-A relationship: City HAS-A Road.

 

 

·         The Certification Summary is a succinct review of the chapter and a restatement of salient points for the exam.

·         The Two-Minute Drill at the end of every chapter is a checklist of the main points of the chapter. It can be used for last-minute review.

·         The Self Test offers questions that closely simulate the topics, structure, and nature of those found on the certification exams. The answers to these questions, as well as explanations of the answers, can be found at the end of each chapter. By taking the Self Test after completing each chapter, you'll reinforce what you've learned from that chapter while becoming familiar with the tricky structure of the exam questions. You can also use the Self Test questions as a way to assess your readiness to take the actual exam. The author helped to develop the real exam, so she has a pretty good idea of how the real questions are structured!

 

 

Some Pointers

Once you've finished reading this book, set aside some time to do a thorough review. You might want to return to the book several times and make use of all the methods it offers for reviewing the material:

 

1.        Re-read all the Two-Minute Drills, or have someone quiz you. You also can use the drills as a way to do a quick cram before the exam. You might want to make some flash cards out of 3 x 5 index cards that have the Two-Minute Drill material on them.

 

2.        Re-read all the Exam Watch notes. Remember that these notes are written by authors who have taken the exam and passed. They know what you should expect—and what you should be on the lookout for.

 

3.        Review all the S&S sections for quick problem solving.

 

4.        Re-take the Self Tests. Taking the tests right after you've read the chapter is a good idea, because the questions help reinforce what you've just learned. However, it's an even better idea to go back later and do all the questions in the book in one sitting. Pretend that you're taking the live exam. (When you go through the questions the first time, you should mark your answers on a separate piece of paper. That way, you can run through the questions as many times as you need to until you feel comfortable with the material.)

 

5.        Complete the Exercises . Did you do the exercises when you read through each chapter? If not, do them! These exercises are designed to cover exam topics, and there’s no better way to get to know this material by practicing.  Be sure you understand why you are performing each step in each exercise. If there is something you are not clear on, re-read that section in the chapter.

 

Introduction to the Material in the book

This section will help prepare you to take the actual Programmer exam. Tips and preparation notes for the Developer exam are presented in the Developer Exam chapters in Part II (chapters 10-17). The Sun Certified Java Programmer exam (SCJP) is considered one of the hardest (if not the hardest) in the IT industry, and we can tell you from experience that a large chunk of exam candidates go in to the test unprepared. And we're talking about the ones who already know Java quite well, and have been programming in it for years! As programmers, we tend to learn only what we need to complete our current project, given the insane deadline we’re usually under. But this exam attempts to prove your complete understanding of the Java language, not just the parts of it you've become familiar with in your work.

   Experience alone will rarely get you through this exam with a passing mark, because even the things you think you know might work just a little differently than you imagined. It isn't enough to be able to get your code to work correctly; you must understand the core fundamentals in a deep way, and with enough breadth to cover virtually anything that could crop up in the course of using the language.

   The Sun Certified Developer Exam is unique to the IT certification realm, because it actually evaluates your skill as a developer rather than simply your knowledge of the language or tools. Becoming a Certified Java Developer is, by definition, development experience.

 

So who cares about certification?

 

Employers do. Headhunters do. Programmers do. Sun's programmer exam has been considered the fastest-growing certification in the IT world, and the number of candidates taking the exam continues to grow each year. Passing this exam proves three important things to a current or prospective employer: you’re smart; you know how to study and prepare for a challenging test; and most of all, you know the Java language. If an employer has a choice between a candidate that’s passed the exam and one who hasn't, the employer knows that the certified programmer does not have to take time to learn the Java language.

   But does it mean that you can actually develop software in Java? Not necessarily, but it’s a good head start. To really demonstrate your ability to develop (as opposed to just your knowledge of the language), you should consider the Developer Exam, where you're given an assignment to build a program, start to finish, and submit it for an assessor to evaluate and score.

 

Sun's Certification Program

Currently there are four Java certification exams. They are the Programmer, the Developer, the Web Component Developer, and the Architect exams. The Programmer and Web Component Developer exams are exclusively multiple-choice exams taken at a testing center, while the Developer and Architect exams involve submitting a project.

 

The Programmer Exam (CX-310-035)

Sun Certified Programmer for Java 2 Platform 1.4

The Programmer exam is designed to test your knowledge of the Java programming language itself. It requires detailed knowledge of language syntax, core concepts, and a small number of application programming interfaces (APIs). It does not test any issues related to program design or architecture, and it
does not ask why one approach is better than another, but rather it asks whether the given approach works in a particular situation.

 

The Developer Exam (CX-310-252A, CX-310-027)

Sun Certified Developer for Java 2 Platform 1.4

The Developer exam picks up where the Programmer exam leaves off. Passing the Programmer exam is required before you can start the Developer exam. The Developer exam requires you to develop an actual program and then defend your design decisions. It is designed to test your understanding of why certain approaches are better than others in certain circumstances, and to prove your ability to follow a specification and implement a correct, functioning, and user-friendly program.

    The Developer exam consists of two pieces: a project assignment, and a follow-up essay exam. Candidates have an unlimited amount of time to complete the project, but once the project is submitted, the candidate then must go to a testing center and complete a short-follow up essay exam, designed primarily to validate and verify that it was you who designed and built the project.

 

The Web Component Developer Exam (CX-310-080)

Sun Certified Web Component Developer for J2EE Platform

The web developer exam is for those who are using Java technology servlet and JSP (Java Server Pages) to build Web applications. It’s based on the Servlet and JSP specifications defined in the Java 2 Enterprise Edition (J2EE). Like the Developer exam, it also requires the candidate to be a Sun Certified Java Programmer.

 

The Architect Exam (CX-310-051)

Sun Certified Enterprise Architect for J2EE Technology

This certification is for enterprise architects, and thus does not require that the candidate pass the Programmer exam. The Architect exam is in three pieces: a knowledge-based multiple-choice exam, an architectural design assignment, and a follow-up essay exam. You must successfully pass the multiple-choices exam before registering and receiving the design assignment.

 

Taking the for the Programmer’s Exam

In a perfect world, you would be assessed for your true knowledge of a subject, not simply how you respond to a series of test questions. But life isn't perfect, and it just isn't practical to evaluate everyone's knowledge on a one-to-one basis.

    For the majority of its certifications, Sun evaluates candidates using a computer-based testing service operated by Sylvan Prometric. This service is quite popular in the industry, and it is used for a number of vendor certification programs, including Novell's CNE and Microsoft's MCSE. Thanks to Sylvan Prometric's large number of  facilities, exams can be administered worldwide, generally in the same town as a prospective candidate.

   For the most part, Sylvan Prometric exams work similarly from vendor to vendor. However, there is an important fact to know about Sun's exams: they use the traditional Sylvan Prometric test format, not the newer adaptive format. This gives the candidate an advantage, since the traditional format allows answers to be reviewed and revised during the test.

 

Many experienced test takers do not go back and change answers unless they have a good reason to do so. Only change an answer when you feel you may have misread or misinterpreted the question the first time. Nervousness may make you second-guess every answer and talk yourself out of a correct one.

 

   To discourage simple memorization, Sun exams present a potentially different set of questions to different candidates. In the development of the exam, hundreds of questions are compiled and refined using beta testers. From this large collection, questions are pulled together from each objective, and assembled into several different versions of the exam.

   Each Sun exam has a specific number of questions (310-035the Programmer’s exam contains 61 questions) and test duration (120 minutes for the Programmer’s exam). Testing time is typically generous, although the 310-035 exam has (for the first time in the Programmer's exam history) generated comments that time could be a factor for those not well-prepared. The time remaining is always displayed in the corner of the testing screen, along with the number of  remaining questions. If  time expires during an exam, the test terminates, and incomplete answers are counted as incorrect.

    At the end of the exam, your test is immediately graded, and the results are displayed on the screen. Scores for each subject area are also provided, but the system will not indicate which specific questions were missed. A report is automatically printed at the proctor's desk for your files. The test score is electronically transmitted back to Sun.

 

When you find yourself stumped answering multiple-choice questions, use your scratch paper to write down the two or three answers you consider the strongest, and then underline the answer you feel is most likely correct. Here is an example of what your scratch paper might look like when you've gone through the test once:

21. B or C

33. A or C

This is extremely helpful when you mark the question and continue on. You  can then return to the question and immediately pick up your thought process where you left off. Use this technique to avoid having to re-read and re-think questions. You will also need to use your scratch paper during complex, text-based scenario questions to create visual images to better understand the question. This technique is especially helpful if you are a visual learner.

Question Format

 

Sun's Java exams pose questions in multiple-choice format. In earlier versions of the exam, you were not told how many answers were correct, but with each version of the exam, the questions have become more difficult, so today each question tells you how many answers to choose. The Self-Test questions at the end of each chapter are closely matched to the format, wording, and difficulty of the real exam questions.

 

Tips on Taking the Exam

There are 61 questions on the 310-025 (1.4) exam. You will need to get at least 32 of them correct to pass—just over 52 percent. You are given two hours to complete the exam. This information is subject to change. Always check with Sun before taking the exam, at www.suned.sun.com.

   You are allowed to answer questions in any order, and you can go back and check your answers after you've gone through the test. There are no penalties for wrong answers, so it's better to at least attempt an answer than to not give one at all.

   A good strategy for taking the exam is to go through once and answer all the questions that come to you quickly. you can then go back and do the others. Answering one question might jog your memory for how to answer a previous one.

   Be very careful on the code examples. Check for syntax errors first, count curly braces, semicolons, and parenthesis and make sure there are as many left ones as right ones. Look for capitalization errors and other such syntax problems before trying to figure out what the code does.

   Many of the questions on the exam will hinge on subtleties of syntax. You will need to have a thorough knowledge of the Java language in order to succeed.

 

Tips on Studying for the Exam

First and foremost, give yourself plenty of time to study. Java is a complex programming language, and you can't expect to cram what you need to know into a single study session. It is a field best learned over time, by studying a
subject and then applying your knowledge. Build yourself a study schedule and stick to it, but be reasonable about the pressure you put on yourself, especially if you're studying in addition to your regular duties at work.

    One easy technique to use in studying for certification exams is the 15-minutes per day effort. Simply study for a minimum of 15 minutes every day. It is a small, but significant commitment. If you have a day where you just can't focus, then give up at 15 minutes. If you have a day where it flows completely for you, study longer. As long as you have more of the “flow days,” your chances of succeeding are extremely high.

   We strongly recommend you use flash cards when preparing for the Programmer’s exam. A flash card is simply a 3x5 or 4x6 index card with a question on the front, and the answer on the back. You construct these cards yourself as you go through a chapter, capturing anything that you think you might need more memorization or practice time. You can drill yourself with them by reading the question, thinking through the answer, then turning the card over to see if you're correct. Or you can get another person to help you by holding up the card with the question facing you, and then verifying your answer. Most of our students have found these to be tremendously helpful, especially because they're so portable that while you’re in study mode, you can take them everywhere. Best not to use them while driving, though, except at red lights. We’ve taken our everywhere — the Dr.’s office, restaurants, theatres, you name it.

   Certification study groups are another excellent resource, and you won't find a larger or more willing community than on the javaranch.com Big Moose Saloon certification forums. If you have a question from this book, or any other mock exam question you may have stumbled upon, posting a question in a certification forum will get you an answer, in nearly all cases, within a day. Usually, within a few hours. You'll find us (the authors) there several times a week, helping those just starting out on their exam preparation journey. (You won't actually think of it as anything as pleasant-sounding as a '‘journey''’ by the time you're ready to take the exam).

 

Scheduling Your Exam

The Sun exams are purhcased directly from Sun, but are scheduled by calling Sylvan Prometric directly. For locations outside the United States, your local number can be found on Sylvan's Web site at http://www.2test.com. Sylvan representatives can schedule your exam,
but they don't have information about the certification programs. Questions about certifications should be directed to Sun's Worldwide Training department.

   These representatives are familiar enough with the exams to find them by name, but it's best if you have the specific exam number handy when you call. After all, you wouldn't want to be scheduled and charged for the wrong exam.

   Exams can be scheduled up to a year in advance, although it's really not necessary. Generally, scheduling a week or two ahead is sufficient to reserve the day and time you prefer. When scheduling, operators will search for testing centers in your area. For convenience, they can also tell which testing centers you've used before.

   When registering for the exam, you will be asked for your ID number. This number is used to track your exam results back to Sun. It's important that you use the same ID number each time you register, so that Sun can follow your progress. Address information provided when you first register is also used by Sun to ship certificates and other related material. In the United States, your Social Security Number is commonly used as your ID number. However, Sylvan can assign you a unique ID number if you prefer not to use your Social Security Number.

 

Arriving at the Exam

As with any test, you'll be tempted to cram the night before. Resist that temptation. You should know the material by this point, and if you're too groggy in the morning, you won't remember what you studied anyway. Instead, get a good night's sleep.

   Arrive early for your exam; it gives you time to relax and review key facts. Take the opportunity to review your notes. If you get burned out on studying, you can usually start your exam a few minutes early. On the other hand, I don't recommend arriving late. Your test could be cancelled, or you may not be left with enough time to complete the exam.

   When you arrive at the testing center, you'll need to sign in with the exam administrator. In order to sign in, you need to provide two forms of identification. Acceptable forms include government-issued IDs (for example, passport or driver's license), credit cards, and company ID badge. One form of ID must include a photograph. They just want to be sure that you don'’t send your brilliant Java guru next-door-neighbor-who-you'’ve-paid in to take the exam for you.

   Aside from a brain full of facts, you don't need to bring anything else to the exam. In fact, your brain is about all you're allowed to take into the exam! All the tests are “closed book,” meaning you don't get to bring any reference materials with you. You're also not allowed to take any notes out of the exam room. The test administrator will provide you with paper and a pencil. Some testing centers may provide a small marker board instead. We do recommend that you bring a water bottle in. Two hours is a long time to keep your brain active, and it functions much better when well-hydrated.

   Leave your pager and telephone in the car, or turn them off. They only add stress to the situation, since they are not allowed in the exam room, and can sometimes still be heard if they ring outside of the room. Purses, books, and other materials must be left with the administrator before entering the exam. While in the exam room, it's important that you don't disturb other candidates; talking is not allowed during the exam.

   Once in the testing room, the exam administrator logs onto your exam, and you have to verify that your ID number and the exam number are correct. If this is the first time you've taken a Sun test, you can select a brief tutorial of the exam software. Before the test begins, you will be provided with facts about the exam, including the duration, the number of questions, and the score required for passing. Then the clock starts ticking and the fun begins.

   The testing software is Windows-based, but you won't have access to the main desktop or any of the accessories. The exam is presented in full screen, with a single question per screen. Navigation buttons allow you to move forward and backward between questions. In the upper-right corner of the screen, counters show the number of questions and time remaining. Most important, there is a ‘Mark' checkbox in the upper-left corner of the screen—this will prove to be a critical tool in your testing technique.

 

Test-Taking Techniques

Without a plan of attack, candidates are overwhelmed by the exam or become side-tracked and run out of time. For the most part, if you are comfortable with the material, the allotted time is more than enough to complete the exam. The trick is to keep the time from slipping away during any one particular problem.

   The obvious goal of an exam is to answer the questions effectively, although other aspects of the exam can distract from this goal. Here are some tips for taking the exam more efficiently.

Size Up the Challenge

First, take a quick pass through all the questions in the exam. “Cherry-pick” the easy questions, answering them on the spot. Briefly read each question, noticing the type of question and the subject. As a guideline, try to spend less than 25 percent of your testing time in this pass.

   This step lets you assess the scope and complexity of the exam, and it helps you determine how to pace your time. It also gives you an idea of where to find potential answers to some of the questions. Often, the answer to one question is shown in the exhibit of another. Sometimes the wording of one question might lend clues or jog your thoughts for another question.

    If you're not entirely confident with your answer to a question, answer it anyway, but check the Mark box to flag it for later review. In the event that you run out of time, at least you've provided a “first guess” answer, rather than leaving it blank.

   Second, go back through the entire test, using the insight you gained from the first go-through. For example, if the entire test looks difficult, you'll know better than to spend more than a minute or so on each question. Break down the pacing into small milestones; for example, “I need to answer 10 questions every 15 minutes.”

   At this stage, it's probably a good idea to skip past the time-consuming questions, marking them for the next pass. Try to finish this phase before you're 50–60 percent through the testing time.

   Third, go back through all the questions you marked for review, using the Review Marked button in the question review screen. This step includes taking a second look at all the questions you were unsure of in previous passes, as well as tackling the time-consuming ones you deferred until now. Chisel away at this group of questions until you've answered them all.

   If you're more comfortable with a previously marked question, unmark it now. Otherwise, leave it marked. Work your way through the time-consuming questions now, especially those requiring manual calculations. Unmark them when you're satisfied with the answer.

  By the end of this step, you've answered every question in the test, despite having reservations about some of your answers. If you run out of time in the next step, at least you won't lose points for lack of an answer. You're in great shape if you still have 10–20 percent of your time remaining.

 

Review Your Answers

Now you're cruising! You've answered all the questions, and you're ready to do a quality check. Take yet another pass (yes, one more) through the entire test, briefly re-reading each question and your answer.

   Carefully look over the questions again to check for “trick” questions. Be particularly wary of those which include a choice of “Does not compile.” Be alert for last-minute clues. You're pretty familiar with nearly every question at this point, and you may find a few clues that you missed before.

 

The Grand Finale

When you're confident with all your answers, finish the exam by submitting it for grading. After what will seem like the longest 10 seconds of your life, the testing software will respond with your score. This is usually displayed as a bar graph, showing the minimum passing score, your score, and a PASS/FAIL indicator.

   If you're curious, you can review the statistics of your score at this time. Answers to specific questions are not presented; rather, questions are lumped into categories, and results are tallied for each category. This detail is also printed on a report that has been automatically printed at the exam administrator's desk.

   As you leave the exam, you'll need to leave your scratch paper behind or return it to the administrator. (Some testing centers track the number of sheets you've been given, so be sure to return them all.) In exchange, you'll receive a copy of the test report.

   This report will be embossed with the testing center's seal, and you should keep it in a safe place. Normally, the results are automatically transmitted to Sun, but occasionally you might need the paper report to prove that you passed the exam.

  In a few weeks, Sun will send you a package in the mail containing a nice paper certificate, a lapel pin, and a letter. You may also be sent instructions for how to obtain artwork for a logo that you can use on personal business cards.

 

 

Re-Testing

If you don't pass the exam, don't be discouraged. Try to have a good attitude about the experience, and get ready to try again. Consider yourself a little more educated. You know the format of the test a little better, and the report shows which areas you need to strengthen.

   If you bounce back quickly, you'll probably remember several of the questions you might have missed. This will help you focus your study efforts in the right area. Serious go-getters will re-schedule the exam for a couple of days after the previous attempt, while the study material is still fresh in their mind.

   Ultimately, remember that Sun certifications are valuable because they're hard to get. After all, if anyone could get one, what value would it have? In the end, it takes a good attitude and a lot of studying, but you can do it!