Introduction - OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808 (2015)

OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808 (2015)


Java, “born” in 1995, is now just about 20 years old. As with anything 20 years old, there is a good amount of history and variation between versions of Java. Over the years, the certification exams have changed to cover different topics. The names of the exams have even changed. This book covers the Java 8 Oracle Certified Associate (OCA) exam.

If you read about “the exam” on the Web, you may see information about the older names for the exam. We've showed the changes in name. Here's what happened. Sun Microsystems used to have two exams. The SCJP (Sun Certified Java Programmer) was meant for programmers and the SCJA (Sun Certified Java Associate) was meant for those who wanted broader knowledge. When Oracle bought Sun Microsystems, they changed all the names from Sun to Oracle, giving us the OCJP and OCJA.


Then Oracle made two strategic decisions with Java 7. They decided to stop updating the OCJA exam. They also decided to cover more on in the programmer space and split it into two exams. Now you first take the OCAJP (Oracle Certified Associate Java Programmer), also known as Java Programmer I, or OCA. That's what this book is about. Then you take the OCPJP (Oracle Certified Professional Java Programmer), also known as Java Programmer II, or OCP. There's also an upgrade exam in case you took an older version of the SCJP or OCPJP and want to upgrade. Most people refer to the current exams as OCA 8, OCP 8, and the Java 8 upgrade exam. We mention when a topic is split between the OCA and OCP so you know which parts are more advanced.

We try to keep the history to a minimum in this book. There are some places on the exam where you need to know both an “old way” and a “new way” of doing things. When that happens, we will be sure to tell you what version of Java introduced it. We will also let you know about topics that are not on the exam anymore in case you see questions in the older free online mock exams.

The OCA Exam

All you need to do to earn the Oracle Certified Associate Java SE 8 Programmer certification is to pass the exam! That's it.

Oracle has a tendency to fiddle with the length of the exam and the passing score once it comes out. Since it's pretty much a guarantee that whatever we tell you here will become obsolete, we will give you a feel for the range of variation. The OCA exam has varied between 60 and 90 questions since it was introduced. The score to pass has varied between 60 percent and 80 percent. The time allowed to take the exam has varied from two hours to two-and-a-half hours.

Oracle has a tendency to “tweak” the exam objectives over time as well. They do make minor additions and removals from what is covered on the exam. Although this tends to affect the OCP exam more than the OCA exam, there are a few topics that were added to the OCA for Java 8. It wouldn't be a surprise for Oracle to make changes.

Although there will likely be minor changes to the scope of the exam, it certainly isn't a secret. We've created a book page on our blog: If there are any changes to the topics on the exam after this book is published, we will note them there.

That book page also contains a link to the official exam page so that you can check the length and passing score that Oracle has chosen for the moment.

Scheduling the Exam

The exam is administered by Pearson VUE and can be taken at any Pearson VUE testing center. To find a testing center or register for the exam, go to Choose IT and then Oracle. If you haven't been to the test center before, we recommend visiting in advance. Some testing centers are nice and professionally run. Others stick you in a closet with lots of people talking around you. You don't want to be taking the test with someone complaining about their broken laptop nearby!

At this time, you can reschedule the exam without penalty until up to 24 hours before. This means that you can register for a convenient time slot well in advance, knowing that you can delay if you aren't ready by that time. Rescheduling is easy and can be done on the Pearson VUE website. This may change, so check the rules before paying.

The Day of the Exam

When you go to take the exam, remember to bring two forms of ID, including one that is government issued. See Pearson's list of what is acceptable ID at Try not to bring too much extra with you as it will not be allowed into the exam room. While you will be allowed to check your belongings, it is better to leave extra items at home or in the car.

You will not be allowed to bring paper, your phone, and so forth into the exam room with you. Some centers are stricter than others. At one center, tissues were even taken away from us! Most centers allow keeping your ID and money. They watch you taking the exam, though, so don't even think about writing notes on money.

The exam center will give you writing materials to use during the exam. These are used as scratch paper during the exam to figure out answers and keep track of your thought process. The exam center will dispose of them at the end. Notice how we said “writing materials” rather than “pen and paper.” Some centers still give pen and paper. Most give a small erasable board and a dry erase marker. If you have a preference to which you receive, call the testing center in advance to inquire.

Finding Out Your Score

In the past, you would find out right after finishing the exam if you passed. Now you have to wait nervously until you can check your score online.

If you go onto the Pearson VUE website, it will just have a status of “Taken” rather than your result. Oracle uses a separate system for scores. You'll need to go to to find out whether you passed and your score. It doesn't update immediately upon taking the test, but we haven't heard of it taking more than an hour. In addition to your score, you'll also see objectives for which you got a question wrong and instructions on how to get a hardcopy certificate.

At some point, you'll get an electronic certificate and some more time after that you'll receive your printed certificate. Sound vague? It is. The times reported to receive certificates vary widely.

Exam Questions

The OCA exam consists of multiple-choice questions. There are typically five or six possible answers. If a question has more than one answer, the question specifically states exactly how many correct answers there are. This book does not do that. We say “choose all that apply” to make the questions harder. This means the questions in this book are generally harder than those on the exam. The idea is to give you more practice so you can spot the correct answer more easily on the real exam.

Note that exam questions will sometimes have line numbers that begin with numbers higher than 1. This is to indicate that you are looking at a code snippet rather than a complete class. We follow this convention as well to get you used to it.

If you read about older versions of the exam online, you might see references to drag-and-drop questions. These questions had you do a puzzle on how to complete a piece of code. There was also a bug in the exam software that caused your answers to get lost if you reviewed them again. Luckily, these are no longer on the exam.

Getting Started

We recommend reading Appendix B, “Study Tips,” before diving into the technical material in this book. Knowing how to approach studying will help you make better use of your study time.

Next, make sure you have downloaded version 8 of the JDK. If you learned Java some time ago, you might have version 7 or even earlier. There have been both big and small changes to the language. You could get a question wrong if you study with the wrong version.

Also, please check our book page to make sure Oracle hasn't changed the objectives. For example, if Oracle decided that lambdas weren't on the exam, you'd want to know that before studying. We will post any updates that you should know about

Getting Help

Both of the authors are moderators at is a very large and active programming forum that is very friendly toward Java beginners. It has a forum just for this exam called OCAJP. It also has a forum called Beginning Java for non-exam-specific questions. As you read the book, feel free to ask your questions in either of those forums. It could be you are having trouble compiling a class or that you are just plain confused about something. You'll get an answer from a knowledgeable Java programmer. It might even be one of us.

Who Should Buy This Book

If you want to become certified as a Java programmer, this book is definitely for you. If you want to acquire a solid foundation in Java and your goal is to prepare for the exam, this book is also for you. You'll find clear explanations of the concepts you need to grasp and plenty of help to achieve the high level of professional competency you need in order to succeed in your chosen field.

This book is intended to be understandable to anyone who has a tiny bit of Java knowledge. If you've never read a Java book before, we recommend starting with a book that teaches programming from the beginning and then returning to this study guide.

This book is for anyone from high school students to those beginning their programming journey to experienced professionals who need a review for the certification.

How This Book Is Organized

This book consists of six chapters, plus supplementary information: a glossary, this introduction, three appendices, and the assessment test after the introduction. You might have noticed that there are more than six exam objectives. We split up what you need to know to make it easy to learn and remember. Each chapter begins with a list of the objectives that are covered in that chapter.

The chapters are organized as follows:

· Chapter 1, “Java Building Blocks,” covers the basics of Java such as scoping variables and how to run a program. It also includes calling methods and types of variables.

· Chapter 2, “Operators and Statements,” focuses on the core logical constructs such as conditionals and loops. It also talks about the meaning and precedence of operators.

· Chapter 3, “Core Java APIs,” introduces you to array, ArrayList, String, StringBuilder, and various date classes.

· Chapter 4, “Methods and Encapsulation,” explains how to write methods, including access modifiers. It also shows how to call lambdas.

· Chapter 5, “Class Design,” adds interfaces and superclasses. It also includes casting and polymorphism.

· Chapter 6, “Exceptions,” shows the different types of exception classes and how to use them.

At the end of each chapter, you'll find a few elements you can use to prepare for the exam:

1. Summary This section reviews the most important topics that were covered in the chapter and serves as a good review.

2. Exam Essentials This section summarizes highlights that were covered in the chapter. You should be readily familiar with the key points of each chapter and be able to explain them in detail.

3. Review Questions Each chapter concludes with at least 20 review questions. You should answer these questions and check your answers against the ones provided in Appendix A. If you can't answer at least 80 percent of these questions correctly, go back and review the chapter, or at least those sections that seem to be giving you difficulty.

The review questions, assessment test, and other testing elements included in this book are not derived from the real exam questions, so don't memorize the answers to these questions and assume that doing so will enable you to pass the exam. You should learn the underlying topic, as described in the text of the book. This will let you answer the questions provided with this book and pass the exam. Learning the underlying topic is also the approach that will serve you best in the workplace—the ultimate goal of a certification.

To get the most out of this book, you should read each chapter from start to finish before going to the chapter-end elements. They are most useful for checking and reinforcing your understanding. Even if you're already familiar with a topic, you should skim the chapter. There are a number of subtleties to Java that you could easily not encounter even when working with Java, even for years.

Free Online Learning Environment

This book provides a free online interactive learning environment and test bank with several additional elements. The online test bank includes:

1. Sample Tests All of the questions in this book, including the 20-question assessment test at the end of this introduction and over 130 questions that make up the Review Question sections for each chapter. In addition, there are three 60-question Practice Exams to test your knowledge of the material. The online test bank runs on multiple devices.

2. Electronic Flashcards Over 200 questions in flashcard format (a question followed by a single correct answer). You can use these to reinforce your learning and provide last-minute test prep before the exam.

3. Glossary The key terms from this book and their definitions are available as a fully searchable PDF.

Go to to register and gain access to this comprehensive study tool package.

Conventions Used in This Book

This book uses certain typographic styles in order to help you quickly identify important information and to avoid confusion about the meaning of words, such as onscreen prompts. In particular, look for the following styles:

· Italicized text indicates key terms that are described at length for the first time in a chapter. (Italics are also used for emphasis.)

· A monospaced font indicates code or command-line text.

· Italicized monospaced text indicates a variable.

In addition to these text conventions, which can apply to individual words or entire paragraphs, a few conventions highlight segments of text:

A note indicates information that's useful or interesting. It is often something to pay special attention to for the exam.


A sidebar is like a note but longer. The information in a sidebar is useful, but it doesn't fit into the main flow of the text.

Real World Scenario

A real world scenario describes a task or an example that's particularly grounded in the real world. Although interesting, the scenario will not show up on the exam.

OCA Exam Objectives

OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808 has been written to cover every OCA exam objective. The following table provides a breakdown of this book's exam coverage, showing you the chapter where each objective or sub-objective is covered:

Exam Objective


  • Java Basics

Define the scope of variables


Define the structure of a Java class


Create executable Java applications with a main method; run a Java program from the command line, including console output


Import other Java packages to make them accessible in your code


Compare and contrast the features and components of Java such as platform independence, object orientation, encapsulation, etc.


  • Working with Java Data Types

Declare and initialize variables (including casting of primitive data types)


Differentiate between object reference variables and primitive variables


Know how to read or write to object fields


Explain an Object's Lifecycle (creation, “dereference by reassignment,” and garbage collection)


Develop code that uses wrapper classes such as Boolean, Double, and Integer


  • Using Operators and Decision Constructs

Use Java operators, including parentheses to override operator precedence


Test equality between Strings and other objects using == and equals ()


Create if and if/else and ternary constructs


Use a switch statement


  • Creating and Using Arrays

Declare, instantiate, initialize, and use a one-dimensional array


Declare, instantiate, initialize, and use multi-dimensional array


  • Using Loop Constructs

Create and use while loops


Create and use for loops including the enhanced for loop


Create and use do/while loops


Compare loop constructs


Use break and continue


  • Working with Methods and Encapsulation

Create methods with arguments and return values, including overloaded methods


Apply the static keyword to methods and fields


Create and overload constructors, including impact on default constructors


Apply access modifiers


Apply encapsulation principles to a class


Determine the effect upon object references and primitive values when they are passed into methods that change the values


  • Working with Inheritance

Describe inheritance and its benefits


Develop code that demonstrates the use of polymorphism, including overriding and object type versus reference type


Determine when casting is necessary


Use super and this to access objects and constructors


Use abstract classes and interfaces


  • Handling Exceptions

Differentiate among checked exceptions, unchecked exceptions, and Errors


Create a try-catch block and determine how exceptions alter normal program flow


Describe the advantages of Exception handling


Create and invoke a method that throws an exception


Recognize common exception classes (such as NullPointerException, ArithmeticException, ArrayIndexOutOfBoundsException, ClassCastException)


  • Working with Selected Classes from the Java API

Manipulate data using the StringBuilder class and its methods


Creating and manipulating Strings


Create and manipulate calendar data using classes from java.time.LocalDateTime, java.time.LocalDate, java.time.LocalTime, java.time.format.DateTimeFormatter, java.time.Period


Declare and use an ArrayList of a given type


Write a simple Lambda expression that consumes a Lambda Predicate expression