Complete Java 2 Certification Study Guide, Second Edition

( 6 )


Roberts and Heller will help you prepare for the multiple-choice Programmer exam. Michael Ernest, a certified Java professional, will then help you tackle the complex programming problems of the Developer exam. Designed specifically to teach you all you need to know to pass the exam, each chapter has been technically reviewed and approved by a member of the Sun Education Team." "Featured on the CD The enclosed CD contains a full-featured test engine, created by one of the authors of the Sun exam. Questions ...
See more details below
Available through our Marketplace sellers.
Other sellers (Hardcover)
  • All (30) from $1.99   
  • New (1) from $50.00   
  • Used (29) from $1.99   
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any coupons and promotions
Seller since 2015

Feedback rating:



New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Sort by
Sending request ...


Roberts and Heller will help you prepare for the multiple-choice Programmer exam. Michael Ernest, a certified Java professional, will then help you tackle the complex programming problems of the Developer exam. Designed specifically to teach you all you need to know to pass the exam, each chapter has been technically reviewed and approved by a member of the Sun Education Team." "Featured on the CD The enclosed CD contains a full-featured test engine, created by one of the authors of the Sun exam. Questions modeled after the real exam test your knowledge, and a timer helps you pace yourself. When you're done, your score is calculated, so you know how you're doing and exactly when you're ready to take the test. You'll also receive the Java SDK for both Unix and NT workstations.

New edition includes five bonus chapters on the Developer's Exam.200 hundred new, challenging practice questions, in the book and on the CD. The CD features a custom testing engine with practice programmer's exam.Includes strategies and tips for passing the exams- A Sample Developer's Assignment.

Read More Show Less

Editorial Reviews

From Barnes & Noble
One Java 2 certification guide covers both the Programmer's and Developer's Exams -- and is coauthored by the leader of the team that wrote all of Sun's exam questions! This is the one -- and it's outstanding. Programmer's Exam coverage: declarations, access control, flow control, exception handling, garbage collection, operators, assignments, overloading, overriding, runtime type, threads, java.awt, java.lang, java.util, Developer's Exam coverage: TCP/IP networking, I/O streams, GUI construction, event model, object serialization, Javadoc, printing, packages, and much more. Includes 200 tough new practice questions in the book and on CD-ROM.
Read More Show Less

Product Details

  • ISBN-13: 9780782128253
  • Publisher: Sybex, Incorporated
  • Publication date: 9/1/2000
  • Edition description: Student Manual, Study Guide, etc.
  • Edition number: 2
  • Pages: 936
  • Product dimensions: 7.79 (w) x 9.26 (h) x 2.22 (d)

Meet the Author

Simon Roberts, the lead author of this book, is a Sun Microsystems programmer, an instructor, an authority on the Java language, and the key player in the development of the entire Java Certification program.

Philip Heller is a consultant, author, educator, and novelist. He worked as an engineer for both Sun and NeXT in the early years.

Mike Ernest is Chief Technical Engineer for Synergistic Computer Solutions in Belmont, CA. He is a Sun-certified instructor as well as a Certified Solaris Administrator and Certified Java Programmer. Roberts and Heller are co-authors of the Java 2 Developer's Handbook, from Sybex.

Read More Show Less

Read an Excerpt

Chapter 6: Objects and Classes

This chapter discusses the object-oriented features of Java. Good coding in Java requires a sound understanding of the object-oriented (OO) paradigm, and this in turn requires a good grasp of the language features that implement objects and classes. The many benefits of object orientation have been the subject of considerable public debate, but for most programmers these benefits have not been realized. In most cases, the reason the promise has not been fulfilled is simply that programmers have not been writing objects. Instead, many programmers have been writing hybrid applications with a mixture of procedural and object-oriented code. Unfortunately, such an approach has given rise, not to some of the benefits of OO, but instead to all the disadvantages of both styles.

Benefits of Object-Oriented Implementation

Beginning with the 1.2 examination, you are required to understand the benefits of object-oriented design. These benefits accrue from two particular features of the OO paradigm. The first of these, and perhaps the most important, is the notion of an abstract data type; the second and perhaps better-known is the extensibility provided by inheritance.

Abstract Data Types

An abstract data type is really just a fancy name for a well-encapsulated aggregate of data and behavior. Consider the primitive data types of any programming language you have ever used. You do not know how these data items are stored and, for the most part, you do not care. What matters are the operations that you can perform on these data items and the boundary conditions within which you can expect those operations to work properly. These primitive types are in fact abstract data types, albeit not user-defined.

Your first goal in defining a good class should be to clearly state the operations that can be applied to instances of that class. Next, consider how to represent the state of the instance, keeping in mind that this should be done only with variables of private accessibility. All behavior should be accessed only via methods. By insisting that the variables inside an object are inaccessible outside the object, you ensure that the nature of those vari-ables is irrelevant outside the object. This in turn means that you can freely change the nature of the storage, for maintenance purposes, for performance improvement, or for any other reason.

Sometimes, perhaps as a consequence of the way you have stored the state in a class, boundary conditions must be applied to its methods. A boundary condition is a limit on the range of arguments for which a method can operate properly. As examples, a square-root function cannot operate conventionally on a negative number; an add operation cannot operate if both of its arguments are more than half the maximum representable range for the operation's return type.

When you encounter a boundary condition that results from your choice of storage format, you must make a choice. If you consider that the bound-ary conditions are reasonable, then you should do two things. First, docu-ment the boundary condition. Next, test the boundary conditions at the entry to the method and, if the boundary condition has been exceeded, throw a runtime exception of some kind. Alternatively, you might decide that the boundary condition is not acceptable, in which case you should redesign the storage used in the class.

Now, consider this: If you had allowed access to any of the variables used to represent the object state, then redefining the way the object's state is stored would immediately cause any other code that uses these variables to have to be rewritten. However, by using only private member variables, we have insisted that all interaction with this object is made through methods and never by direct variable access—so we have eliminated this problem. In consequence, we are able to redesign our internal storage freely and, provided the signatures of all the methods remain the same, no other code needs to change.

Sometimes you will realize that the methods you have provided for a class are inadequate. This is not usually a problem, either. You may add new methods to freely provide additional functionality. No client code will break, provided the methods that were already provided remain available, with the same signatures and the same semantics. The only issues that might arise during maintenance are if you realize that a method you have defined has a fundamentally flawed prototype. This should not happen often, since it implies that the operation you defined for the class was conceptually flawed in some way.

Encapsulation and Perceived Efficiency

Many programmers have such deep-seated concerns about performance that they cannot bring themselves to force all access to their objects to be made through methods, and they resist creating classes with entirely private member variables. There are several reasons why this is an unwise approach. First, fully encapsulated classes are more likely to be used correctly, especially if boundary conditions are properly flagged with excep-tions— therefore, code using them is more likely to be correct. Second, bug fixes and maintenance changes are less likely to break the program as a whole, since the effects of the change are confined to the affected class. These reasons fall into the broad heading of "Would your customer prefer a slow program that works and is delivered on time (and that can be made faster later) or a program that is delivered late, works incorrectly, but runs quickly?"

There are more reasons why fully encapsulated classes are the right way to start out a design. An optimizing virtual machine such as Sun's HotSpot can transparently optimize simple variable access methods by "inlining." This approach allows the program all the robustness, reliability, and maintain-ability that results from full encapsulation, while giving the runtime perfor-mance associated with direct variable access. Furthermore, if you decide that a program's slow performance is attributable to the use of private variables and accessor/mutator methods, then changing the variable to be more accessible does not require any changes to the rest of the code, either inside or outside the class. On the other hand, if you have code that fails to run properly as a result of making direct variable access, you will find that reducing the accessibility of the relevant variable will require considerable collateral changes in many other pieces of code (all code that makes such direct access).


We have discussed how tight encapsulation can make code that is more reliable and robust. Now we will consider the second most significant advantage of object-oriented programming: code reuse.

Writing good, encapsulated classes usually requires more work in the initial stages than would have been required to produce the same functionality with a traditional programming approach. While this is true, you will normally find that using rigorous OO techniques will actually reduce the overall time required to produce finished code. This happens for two reasons. The first is that the robust classes you produce actually require less time to integrate into the final program and less time to fix bugs. The second is that with careful design you can reuse classes even in some circumstances that are different from the original intent of the class.

This reuse is actually possible in two ways, using either composition (the "has a" relation) or inheritance (the "is a" relation). Composition is probably safer and easier to control, although inheritance—perhaps because it is perceived as "pure OO"—seems to be more interesting and appealing to most programmers.

The Java certification exam does not require you to discuss details of object-oriented design techniques or the relative merits and weaknesses of composition versus inheritance. However, you should appreciate one significant sequence of facts: If a class is well encapsulated, it will be easier to reuse successfully. The more a class is reused, the better tested it will be and the fewer bugs it will have. Better-tested, less-buggy classes are easier to reuse. This sequence leads to a positive spiral of quality since the better the class, the easier and safer it becomes to reuse. All this comes from tight encapsulation.

Now that we've discussed why you would want to write object-oriented code, let's look at how this is achieved....

Read More Show Less

Table of Contents

Pt. I The Programmer's Exam 1
Ch. 1 Language Fundamentals 3
Ch. 2 Operators and Assignments 29
Ch. 3 Modifiers 71
Ch. 4 Converting and Casting 99
Ch. 5 Flow Control and Exceptions 127
Ch. 6 Objects and Classes 163
Ch. 7 Threads 199
Ch. 8 The java.lang and java.util Packages 233
Ch. 9 Layout Managers 259
Ch. 10 Events 295
Ch. 11 Components 313
Ch. 12 Painting 343
Ch. 13 Input and Output 375
Pt. II The Developer's Exam 403
Ch. 14 Taking the Developer's Exam 405
Ch. 15 Assignment: Room Reservation System 419
Ch. 16 Enhancing and Extending the Database 433
Ch. 17 Writing the Network Protocol 461
Ch. 18 Designing the User Interface 501
Ch. 19 Thinking about the Follow-Up Exam 531
Appendices 545
App. A: Answers 547
App. B Using the Test Program 575
App. C Java 2 API Reference 583
Glossary 857
Index 861
Read More Show Less


Hello! Come in, sit down, and make yourself at home. Please get comfortable; there are a lot of topics to cover in this book.

You have come here because you are ready. Ready to get ready, at least, which is practically the same thing. Now all that's left to do is the work.

And there is a lot of work to be done. Probably you heard that the 1. 1 version of the exam was difficult. That was true; the Java 2 version is harder still, since it covers a few more topics. Not everybody passes--even on repeated attempts. We want to change these statistics. It wouldn't hurt to get a little help--and we're the ones to help.

Since this is, after all, the Introduction, allow us to introduce ourselves: Simon, Mike, and Phil. We are Java instructors by day, and by night we write.

What we teach (by day) are Sun Microsystems' Java courses. When the 1.1 edition of this book was published, we wrote that among us we had taught Java to more than 1,000 people. By now the number is well into the thousands. And the Java courses that we teach are Sun's own courses. We have been through our own certification process for instructors, and Sun trusts us to teach people the Java facts that Sun considers important. Recently, Simon has been developing new course material. We want you to know all this because we want to be the ones to help you pass the certification exam.

What we write (by night) are Java books. (Phil keeps talking about a novel; we will just have to wait and see.) We wrote the Java 1. 1 Developer's Handbook (Sybex, 1997) and we contributed to Mastering Java 1. 1 (Sybex, 1997). Then we wrote the Java 1. 1 Certification Study Guide.After that we revised the Developer's Handbook to reflect new Java 2 material. And now here we are, presenting the Java 2 version of the Certification Study Guide.

We thought we were the best team to write this book. Simon led the team that wrote all of the questions for the exam. Phil was a consultant for developing the exam and is one of the graders for the developer's exam, so he also has the inside view of things. And Mike, who wrote the chapters about the developer's exam, has been on the front lines of Java instruction for years.

Simon's unique position at Sun places a few restrictions on us. We can't give away any answers to the questions on the exam. (We wouldn't want to do that anyway; we want you to pass because you're good at Java, not because we slipped you a crib.) We had to make sure that the sample questions did not accidentally match any of the real test questions. It took a bit more work, but we think the benefit to you is tremendous: Everything in this book is here for a very good reason. If it's here, then it's here because we know you need to know about it. We understand that buying a book like this costs you money, reading it costs you time, and absorbing it costs you effort. We appreciate your investment and we believe it will pay off.

If you read this book, absorb it, solve the practice questions at the end of each chapter, and work through the practice exam on the CD-ROM, you will be in the best possible position when you walk through the doors of your local testing center.

Let's just take care of a few standard formalities and then we can really get started.

What's New in This Edition

The original edition of this book covered the 1. 1 version of the programmer's exam. When Sun released Java 2, they also released new versions of both the programmer's exam and the developer's exam, along with corresponding lists of study objectives.

There were more than 90 objectives for the 1.1 programmer's exam; that number has been reduced for Java 2 to about 30. The huge reduction doesn't mean that the exam is simpler; it just means that redundant objectives have been combined or eliminated. We have stayed with the format that we introduced in the original edition of this book: a chapter begins with a list of the objectives covered in the chapter. All of the objectives appear at least once, so if you master each chapter, you will have mastered all of the objectives.

So, our first change was to introduce the new Java 2 material. We also thought it would be appropriate to upgrade the test engine. The sample questions at the end of each chapter are for the most part unchanged, because we originally designed those questions to teach you as much as possible. The original questions were very well accepted, so we stayed with them, but we made two additions. First, of course, we added questions to cover the new Java material as reflected in the new objectives. Second, we added many new questions to the test engine on the CD-ROM that accompanies this book. Please refer to Appendix B for information on how to use the test engine.

If you are intrigued by the idea of sample questions, here is a sample of the samples:

3. Which of the following statements is true?
A. An abstract class may not have any final methods.

B. A final class may not have any abstract methods.

Here is a typical code-related question:

3. Will the following code compile?
1. byte b 2;

2. byte b1 3;

3. b = b * b1

Feel free to look up the answers in Appendix A. The first question is #3 from Chapter 3; the second question is #3 from Chapter 4.

The other big change was to include an extensive new section on the Java Developer's Exam. We received a lot of feedback from readers who said that they were interested in complete certification, not just programmer certification. So Mike was brought in to write about developer certification. We can't tell you what your developer's assignment will be (any more than we can tell you about questions on the programmer's exam); but we have given you a similar problem, one that can serve as a metaphor and that requires you to master the same skills that you will need for the real exam.

We hope that the Java 2 edition of this book will be all you need to catapult you into both programmer and developer certification.

Taking the Exam

You can take the Java Certification Exam whenever you like, by making an appointment with Sylvan Prometric or Sun Educational Services. Sylvan Prometric administers the exam on Sun's behalf; they have test centers throughout the world, so hopefully you won't have to travel far. The cost of taking the exam is $150.

Note: The telephone number for Sylvan Prometric is 800-795-EXAM; their URL is The number for Sun Educational Services is 800-422-8020; their URL is programs.htmI. For people outside the United States, information on registration in any of the eighty-eight countries that Sylvan services is available at this site:

You can make an appointment any time during regular business hours. You will be given two hours and fifteen minutes and you will probably need every minute. You will not be allowed to bring food or personal belongings into the test area. One piece of scratch paper is permitted; you will not be allowed to keep it after you have finished the exam. (See the end of Chapter 9, "Layout Managers," for a suggestion about how to use the scratch paper.) Most sites have security cameras.

You will be escorted to a cubicle containing a PC. The exam program will present you with randomly selected questions. Navigation buttons take you to the next question or to previous questions for review and checking. When you have finished the test, the program will immediately present you with your score and a pass/fail indication. You will also be given feedback that indicates how well you performed in each of the dozen or so categories of the objectives. You will not be told which particular questions you got right or wrong.

Formalities of the Exam

There are no trick questions on the exam, but every question requires careful thought. The wording of the questions is highly precise; the exam has been reviewed not just by Java experts, but also by language experts whose task was to eliminate any possible ambiguity. All you have to worry about is knowing Java; your score will not depend on your ability to second-guess the examiners.

It is not a good idea to try to second-guess the question layout. For example, do not be biased toward answer C simply because C has not come up recently. The questions are taken from a pool and presented to you in a random order, so it is entirely possible to get a run of a particular option; it is also possible to get the answers neatly spread out.

Most of the questions are multiple choice. Of these, some have a single answer while others require you to select all the appropriate responses. The Graphical User Interface of the test system indicates which kind of answer you should supply. If a question only has one correct answer, you will be presented with radio buttons, so that selecting a second answer cancels the selection of a previous answer. With this kind of question, you have to select the most appropriate answer. If, on the other hand, you are presented with check boxes, then you may need to make more than one selection, so every possible answer has to be considered on its own merits-not weighed against the others.

You should be aware that where multiple answers are possible, you are being asked to make a decision about each answer, rather as though the question were five individual true/false questions. This requires more effort and understanding from you, but does not actually mean that more than one answer is correct. Think carefully, and always base your answer on your knowledge of Java.

The short-answer, type-in questions often cause undue concern. How are they marked? What happens if you omit a semicolon? These worries can stem from the knowledge that the questions are marked electronically and the belief that an answer might be marked wrong simply because the machine didn't have the sense to recognize a good variation of what it was programmed to accept.

As with all exam questions, you should be careful to answer precisely what is asked. However, you should also be aware that the system does accept a variety of different answers; it has been set up with all the variations that the examination panel considered to be reasonable.

Some of the type-in questions provide specific instructions concerning the format of the answer. Take this guidance seriously. If, for example, a question says, "Answer in the form methodname(), " then your answer should be


and not any of these answers



method(a, b)


Some of the other answers might well be accepted, but programming is a precision job and you should be accustomed to following precise directions.

The test is taken using a windowed interface that can be driven almost entirely with the mouse. Many of the screens require scrolling; the scroll bar is on the right-hand side of the screen. Always check the scroll bar so you can be sure you have read a question in its entirety. It would be a shame to get a question wrong because you didn't realize you needed to scroll down a few lines.

The exam contains about 60 questions. On average, this gives you a little more than two minutes per question. Some of the questions are easier than others, and undoubtedly there will be some that you can answer faster than others. However, you really do need to answer all the questions, if you possibly can. The test system allows you to review your work after you reach the end. The system will explicitly direct your attention toward any multiple choice questions that have no items selected. So if you find a particular question difficult, consider moving on and coming back to it later.

If you pass, you will be given a temporary certificate. A few weeks later you will receive by mail a permanent certificate, along with an artwork sheet. The artwork shows the "Sun Certified Java Programmer" logo at various magnifications. By passing the exam, you have earned the right to display the logo. Printers know how to reproduce the artwork onto business cards, stationery, and so on. The lettering is legible (just barely, by people who eat carrots) down to a reduction of about 5/8 " wide by 3/8 " high.

Read More Show Less

Customer Reviews

Average Rating 4
( 6 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 6 Customer Reviews
  • Anonymous

    Posted November 13, 2002

    A good Start towards the Cert.

    I have read this book and I think that this is a good start toward the certification, the book covers alot of topics in a simple easy to understand and memories way, this is an in-bridth coverage rather to be in-depth one, yet it is vey good for the exam.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted February 13, 2002

    Not at all what I expected

    This book isn't what I expected. Its full of errors and inconsistencies. Did anyone proofread? I had trouble with the code in many places. Overall I came away wondering if the authors knew what they were doing.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted January 10, 2002

    I recommend this book

    This is a great book. Everything you need to know is covered and explained. The sample exams are excellent. I scored mid 70's on the sample exams and also on the real exam.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted December 22, 2000

    Excellent book

    This is an excellent book to prepare yourself for the Programmers Exam. I'm an undergrad with no experience; took a Java class and studied from this book and PASSED the exam. I learned a lot of things (from this book) about the Java Language that my undergraduate Java class didnt teach me.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted October 16, 2000

    JAVA 2 Certification

    This book is an excellent material for the preparation of Java Programmer Certificaiton. The recommended reader level for this book is Intermediate/Advanced ; hence the beginners, should study some other entry level book, before they start reading this book. The test at the end of each topic and their answers at the end of the book are comprehensive and are adequete to build a good understanding level for the readers.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted October 14, 2000

    Good companion for learning Java

    I study Java 2 from other books and bought this book so I could check how well I am doing. This book is excellent for that purpose. I am not studying for either of the exams (Programmer's or Developer's) but this book is very valuable. The first 400 pages are about the programmer's exam. Each chapter is about one objective and in the end you can take a full mock test about the whole area. This first part is what I use frequently to test my skills and knowledge. The rest of the book is not so precise, for the Developer's exam is not about multiple choice questions. This part has articles about how a sample problem, similar to those in the exam, is solved apropriately. If you are studying Java 2 and need a way to keep sure that you are learning what the trade and business needs, this book is an excellent companion.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 6 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)