Java SE 11 Programmer I Certification Guide
Covers Exam 1Z0-815
Mala Gupta
  • MEAP began January 2020
  • Publication in Spring 2021 (estimated)
  • ISBN 9781617297465
  • 725 pages (estimated)
  • printed in black & white
OCP Java SE 11 Programmer I Certification Guide prepares you for the 1Z0-815 certification test with complete coverage of the exam. You'll explore important Java topics as you systematically learn what's required to pass. Memorable analogies, fun visual aids, and sample questions make sure your knowledge sticks and is easy to recall when you are sitting for the exam. In its third edition, this book has been proven effective by thousands of now-certified Java developers.

About the Technology

After more than twenty years, Java is still one of the world’s most popular languages and in great demand from employers. Java certifications tell hiring managers that you know your stuff, and cracking the OCP Java SE 11 Programmer I Certification is no easy task. To earn your certification you’ll not only need to know your Java inside and out, you’ll need to understand the test itself. This book reviews the Java you’ll need as it walks you through questions and exercises like the ones you’ll see on test day.

About the book

OCP Java SE 11 Programmer I Certification Guide prepares you for the 1Z0-815 with complete and thorough coverage of the exam topics. Each chapter starts with a list of exam objectives mapped to section numbers, followed by sample questions and exercises that reinforce key concepts. Complex topics are explained through analogies, visual aids, and comic strips that you can easily remember under exam conditions. Specially designed “Twist in the Tale” exercises help you reevaluate and modify code to answer wild card exam questions you’ve not previously prepared for. You’ll also get the scoop on common exam mistakes and ways to avoid traps and pitfalls. With this book as your study guide, you’ll be ready and confident on test day.
Table of Contents detailed table of contents

1 Java technology and environment

1.1 Java Technology – what, where and why

1.1.1 How did it start

1.1.2 Java’s release cadence

1.2 Java’s magic – Java Virtual Machine and bytecode

1.3 Development Tools

1.4 Demystifying acronyms in the Java world

1.4.1 Java SE, JSR and JCP

1.4.2 JDK, JVM and JRE

1.5 Your first Java program - Conquer the world

1.6 Features of Java

1.6.1 Irrelevant features and components of Java

1.7 Looking ahead

1.8 Summary

1.9 Sample exam questions

1.10 Answers to sample exam questions

2 Creating a Simple Java Program

2.1 Executable Java applications

2.1.1 Executable Java classes versus nonexecutable Java classes

2.2 Main method

2.3 Command line – code compilation and execution

2.4 Java packages

2.4.1 The need for packages

2.4.2 Defining classes in a package using the package statement

2.4.3 Package naming conventions

2.4.4 Directory structure and package hierarchy

2.4.5 Using simple names with import statements

2.4.6 Using packaged classes without using the import statement

2.4.7 Importing a single member versus all members of a package

2.4.8 Recursively importing subpackages

2.4.9 Importing classes from the default package

2.4.10 Java source files with multiple classes or interfaces

2.4.11 Static imports

2.5 Summary

2.6 Sample exam questions

2.7 Answers to sample exam questions

3 Describing objects and classes

3.1 The structure of a Java class and a source code file

3.1.1 Structure of a Java class

3.2 Object’s lifecycle

3.2.1 An object is born

3.2.2 Object is accessible

3.2.3 Object is inaccessible

3.2.4 Garbage collection

3.3 Read or write to object fields

3.3.1 What is an object field?

3.3.2 Read and write object fields

3.3.3 Calling methods on objects

3.4 Summary

3.5 Sample exam questions

3.6 Answers to sample exam questions

4 Java data types

4.1 Primitive data types

4.1.1 Data type - boolean

4.1.2 Numeric data types

4.1.3 Data type – char (unsigned integer)

4.2 Casting and promotion of primitive data types

4.2.1 What is casting

4.3 Object reference variables

4.3.1 What are object reference variables?

4.3.2 Comparing reference and primitive variables

4.4 Scope of variables

4.4.1 Local variables

4.4.2 Method parameters

4.4.3 Instance variables

4.4.4 Class variables

4.4.5 Overlapping variable scopes

4.5 Local variable type inference

4.5.1 What is type inference

4.5.2 Type inference with var

4.5.3 Is this a local variable?

4.5.4 Where you can and can’t use var

4.5.5 Rules – do’s and don’ts

4.5.6 Benefits of using var

4.6 Summary

4.6.1 Sample exam questions

4.7 Answers to sample exam questions

5 String APIs

5.1 Welcome to the world of the String class

5.1.1 Compact Strings

5.1.2 Creating String objects

5.1.3 The class String is immutable

5.1.4 Methods of the class String

5.1.5 String objects and operators

5.1.6 Determining equality of Strings

5.2 Mutable strings: StringBuilder

5.2.1 The StringBuilder class is mutable

5.2.2 Creating StringBuilder objects

5.2.3 Methods of class StringBuilder

5.2.4 A quick note on the class StringBuffer

5.3 Summary

5.4 Sample exam questions

5.5 Answers to sample exam questions

6 Using operators and decision constructs

6.1 Operators

6.1.1 Assignment operators

6.1.2 Arithmetic operators

6.1.3 Relational operators

6.1.4 Logical operators

6.1.5 Operator precedence

6.2 The if, if-else, and ternary constructs

6.2.1 The if construct and its flavors

6.2.2 Missing else blocks

6.2.3 Implications of the presence and absence of {} in if-else constructs

6.2.4 Appropriate versus inappropriate expressions passed as arguments to an if statement

6.2.5 Nested if constructs

6.2.6 Ternary construct

6.3 The switch statement

6.3.1 Create and use a switch statement

6.3.2 Comparing a switch statement with multiple if-else constructs

6.3.3 Arguments passed to a switch statement

6.3.4 Values passed to the label case of a switch statement

6.3.5 Use of break statements within a switch statement

6.4 The for loop

6.4.1 Initialization block

6.4.2 Termination condition

6.4.3 The update clause

6.4.4 Optional parts of a for statement

6.4.5 Nested for loop

6.5 The enhanced for loop

6.5.1 Iteration with enhanced for loop

6.5.2 Limitations of the enhanced for loop

6.5.3 Nested enhanced for loop

6.6 The while and do-while loops

6.6.1 The while loop

6.6.2 The do-while loop

6.6.3 while and do-while block, expression, and nesting rules

6.7 Comparing loop constructs

6.7.1 Comparing do-while and while loops

6.7.2 Comparing for and enhanced for loops

6.7.3 Comparing for and while loops

6.8 Loop statements: break and continue

6.8.1 The break statement

6.8.2 The continue statement

6.8.3 Labeled statements

6.9 Review notes

6.10 Sample exam questions

6.11 Answers to sample exam questions

7 Arrays

7.1 Arrays

7.2 Array declaration

7.3 Array allocation

7.4 Array initialization

7.5 Combining array declaration, allocation, and initialization

7.6 Summary

7.7 Sample exam questions

7.8 Answers to sample exam questions

8 Creating and using methods

8.1 Create methods with arguments and return types

8.1.1 Return type of a method

8.1.2 Method parameters

8.1.3 Return statement

8.2 Create and invoke overloaded methods

8.2.1 Argument list

8.2.2 Return type

8.2.3 Access level

8.3 Create and invoke constructors

8.3.1 User-defined constructors

8.3.2 Default constructor

8.4 Overloaded constructors

8.5 Nonaccess modifiers

8.5.1 abstract modifier

8.5.2 final modifier

8.5.3 static modifier

8.6 Summary

8.7 Sample exam questions

8.8 Answers to sample exam questions

9 Apply encapsulation

9.1 Access modifiers

9.1.1 Why do you need access modifiers

9.1.2 Public access modifier

9.1.3 Protected access modifier

9.1.4 Default access (package access)

9.1.5 Defining a class Book with default access

9.1.6 private access modifier

9.1.7 Access modifiers and Java entities

9.2 Apply encapsulation principles to a class

9.2.1 Need for encapsulation

9.2.2 Apply encapsulation

9.3 Passing objects and primitives to methods

9.3.1 Passing primitives to methods

9.3.2 Passing object references to methods

9.4 Summary

9.5 Sample exam questions

9.6 Answers to sample exam questions

10 Reusing implementations through Inheritance

10.1 Inheritance with classes

10.1.1 The need to inherit classes

10.1.2 Benefits

10.1.3 A derived class contains within it an object of its base class

10.1.4 Which base class members are inherited by a derived class?

10.1.5 Which base class members aren’t inherited by a derived class?

10.1.6 Derived classes can define additional properties and behaviors

10.2 Abstract classes

10.2.1 Defining an abstract class

10.2.2 abstract methods

10.2.3 Extending an abstract class

10.2.4 Abstract base class versus concrete base class

10.3 Enable polymorphism by overriding methods

10.3.1 Polymorphism with classes

10.3.2 Binding of variables and methods at compile time and runtime

10.3.3 Polymorphism with interfaces

10.4 Reference variable and object types

10.4.1 Using a variable of the derived class to access its own object

10.4.2 Using a variable of a superclass to access an object of a derived class

10.4.3 Using a variable of an implemented interface to access a derived class object

10.4.4 Binding of variables and methods at compile time and runtime

10.4.5 The need for accessing an object using the variables of its base class or implemented interfaces

10.5 Casting

10.5.1 How to cast a variable to another type

10.5.2 Need for casting

10.6 Use this and super to access objects and constructors

10.6.1 Object reference: this

10.6.2 Object reference: super

10.7 Compare overloading, overriding, and hiding

10.7.1 Method hiding

10.7.2 Rules to distinguish method overloading, overriding and hiding

10.8 Summary

10.9 Sample exam questions

10.10 Answers to sample exam questions

11 Programming abstractly using interfaces

11.1 Create and implement interfaces

11.1.1 Defining an interface

11.1.2 Identifying when to define interfaces

11.1.3 Types of methods in an interface

11.1.4 Implementing an interface

11.1.5 A class can’t extend multiple classes

11.1.6 A class can implement multiple interfaces

11.1.7 Extending interfaces

11.1.8 Modifying existing methods of an interface

11.2 Class inheritance vs interface inheritance

11.2.1 Essence of inheriting a class vs implementing an interface

11.2.2 Inheriting state

11.2.3 Inheriting behavior

11.2.4 Mandatory implementation of behavior

11.2.5 Inheriting constructors

11.2.6 Using reference variables of interface or base classes

11.2.7 Multiple inheritance

11.2.8 When to inherit a class or implement an interface

11.3 List and ArrayList

11.3.1 Creating an ArrayList

11.3.2 Adding elements to an ArrayList

11.3.3 Accessing elements of an ArrayList

11.3.4 Modifying the elements of an ArrayList

11.3.5 Deleting the elements of an ArrayList

11.3.6 Other methods of ArrayList

11.4 Lambda expressions

11.4.1 Comparing passing values with passing code to methods

11.4.2 Syntax of lambda expressions

11.4.3 Interface Predicate

11.5 Summary

11.6 Sample exam questions

11.7 Answers to sample exam questions

12 Exception handling

12.1 Exceptions in Java

12.1.1 A taste of exceptions

12.1.2 Why handle exceptions separately?

12.1.3 Does exception handling offer any other benefits?

12.2 Categories of exceptions

12.2.1 Identifying exception categories

12.2.2 Class hierarchy of exception classes

12.2.3 Checked exceptions

12.2.4 Runtime exceptions

12.2.5 Errors

12.3 Creating a method that throws an exception

12.3.1 Create a method that throws a checked exception

12.3.2 Handle-or-declare rule

12.3.3 Creating a method that throws runtime exceptions or errors

12.3.4 A method can declare to throw all types of exceptions, even if it doesn’t

12.4 What happens when an exception is thrown?

12.4.1 Creating try-catch-finally blocks

12.4.2 Using a method that throws a checked exception

12.4.3 Using a method that throws a runtime exception

12.4.4 Using a method that throws an error

12.4.5 Will a finally block execute even if the catch block defines a return statement?

12.4.6 What happens if both a catch and a finally block define return statements?

12.4.7 What happens if a finally block modifies the value returned from a catch block?

12.4.8 Can a try block be followed only by a finally block?

12.4.9 Does the order of the exceptions caught in the catch blocks matter?

12.4.10 Can I rethrow an exception or the error I catch?

12.4.11 Can I declare my methods to throw a checked exception instead of handling it?

12.4.12 I can create nested loops, so can I create nested try-catch blocks too?

12.4.13 Should I handle errors?

12.5 Review notes

12.6 Sample exam questions

12.7 Answers to sample exam questions

13 Handling Modules

14 Sample mock exam

What's inside

  • Complete coverage of the OCP Java SE 11 Programmer I exam
  • Hands-on coding exercises
  • Behind the scenes with classes in Java APIs
  • How to avoid built-in traps and pitfalls
  • Sample questions written in the exam format

About the reader

For beginning to intermediate Java programmers studying to become an Oracle Certified Java Professional.

About the author

Mala Gupta is a Java coach and trainer, a developer advocate for Jetbrains, and a Java Champion. She holds multiple Java certifications, and since 2006, she has been actively supporting Java certification as a path to career advancement.

placing your order...

Don't refresh or navigate away from the page.
Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
print book $49.99 pBook + eBook + liveBook
Additional shipping charges may apply
Java SE 11 Programmer I Certification Guide (print book) added to cart
continue shopping
go to cart

eBook $19.99 $39.99 3 formats + liveBook
Java SE 11 Programmer I Certification Guide (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks