Home Page Icon
Home Page
Table of Contents for
OCA Java® SE 8 Programmer I Exam Guide (Exam 1Z0-808)
Close
OCA Java® SE 8 Programmer I Exam Guide (Exam 1Z0-808)
by Bert Bates, Kathy Sierra
OCA Java SE 8 Programmer I Exam Guide (Exams 1Z0-808)
Cover Page
Title Page
Copyright Page
Contents
Acknowledgments
Preface
Introduction
1 Declarations and Access Control
Java Refresher
Features and Benefits of Java (OCA Objective 1.5)
Identifiers and Keywords (OCA Objectives 1.2 and 2.1)
Legal Identifiers
Oracle’s Java Code Conventions
Define Classes (OCA Objectives 1.2, 1.3, 1.4, 6.4, and 7.5)
Source File Declaration Rules
Using the javac and java Commands
Using public static void main(String[ ] args)
Import Statements and the Java API
Static Import Statements
Class Declarations and Modifiers
Exercise 1-1: Creating an Abstract Superclass and Concrete Subclass
Use Interfaces (OCA Objective 7.5)
Declaring an Interface
Declaring Interface Constants
Declaring default Interface Methods
Declaring static Interface Methods
Declare Class Members (OCA Objectives 2.1, 2.2, 2.3, 4.1, 4.2, 6.2, 6.3, and 6.4)
Access Modifiers
Nonaccess Member Modifiers
Constructor Declarations
Variable Declarations
Declare and Use enums (OCA Objective 1.2)
Declaring enums
Certification Summary
Two-Minute Drill
Q&A Self Test
Self Test Answers
2 Object Orientation
Encapsulation (OCA Objectives 6.1 and 6.5)
Inheritance and Polymorphism (OCA Objectives 7.1 and 7.2)
The Evolution of Inheritance
IS-A and HAS-A Relationships
Polymorphism (OCA Objective 7.2)
Overriding/Overloading (OCA Objectives 6.1 and 7.2)
Overridden Methods
Overloaded Methods
Casting (OCA Objectives 2.2 and 7.3)
Implementing an Interface (OCA Objective 7.5)
Java 8—Now with Multiple Inheritance!
Legal Return Types (OCA Objectives 2.2 and 6.1)
Return Type Declarations
Returning a Value
Constructors and Instantiation (OCA Objectives 6.3 and 7.4)
Constructor Basics
Constructor Chaining
Rules for Constructors
Determine Whether a Default Constructor Will Be Created
Overloaded Constructors
Initialization Blocks (OCA Objectives 1.2 and 6.3-ish)
Statics (OCA Objective 6.2)
Static Variables and Methods
Certification Summary
Two-Minute Drill
Q&A Self Test
Self Test Answers
3 Assignments
Stack and Heap—Quick Review
Literals, Assignments, and Variables (OCA Objectives 2.1, 2.2, and 2.3)
Literal Values for All Primitive Types
Assignment Operators
Exercise 3-1: Casting Primitives
Scope (OCA Objective 1.1)
Variable Scope
Variable Initialization (OCA Objectives 2.1, 4.1, and 4.2)
Using a Variable or Array Element That Is Uninitialized and Unassigned
Local (Stack, Automatic) Primitives and Objects
Passing Variables into Methods (OCA Objective 6.6)
Passing Object Reference Variables
Does Java Use Pass-By-Value Semantics?
Passing Primitive Variables
Garbage Collection (OCA Objective 2.4)
Overview of Memory Management and Garbage Collection
Overview of Java’s Garbage Collector
Writing Code That Explicitly Makes Objects Eligible for Collection
Exercise 3-2: Garbage Collection Experiment
Certification Summary
Two-Minute Drill
Q&A Self Test
Self Test Answers
4 Operators
Java Operators (OCA Objectives 3.1, 3.2, and 3.3)
Assignment Operators
Relational Operators
instanceof Comparison
Arithmetic Operators
Conditional Operator
Logical Operators
Operator Precedence
Certification Summary
Two-Minute Drill
Q&A Self Test
Self Test Answers
5 Flow Control and Exceptions
Using if and switch Statements (OCA Objectives 3.3 and 3.4)
if-else Branching
switch Statements
Exercise 5-1: Creating a switch-case Statement
Creating Loops Constructs (OCA Objectives 5.1, 5.2, 5.3, 5.4, and 5.5)
Using while Loops
Using do Loops
Using for Loops
Using break and continue
Unlabeled Statements
Labeled Statements
Exercise 5-2: Creating a Labeled while Loop
Handling Exceptions (OCA Objectives 8.1, 8.2, 8.3, 8.4, and 8.5)
Catching an Exception Using try and catch
Using finally
Propagating Uncaught Exceptions
Exercise 5-3: Propagating and Catching an Exception
Defining Exceptions
Exception Hierarchy
Handling an Entire Class Hierarchy of Exceptions
Exception Matching
Exception Declaration and the Public Interface
Exercise 5-4: Creating an Exception
Rethrowing the Same Exception
Common Exceptions and Errors (OCA Objective 8.5)
Where Exceptions Come From
JVM-Thrown Exceptions
Programmatically Thrown Exceptions
A Summary of the Exam’s Exceptions and Errors
Certification Summary
Two-Minute Drill
Q&A Self Test
Self Test Answers
6 Strings, Arrays, ArrayLists, Dates, and Lambdas
Using String and StringBuilder (OCA Objectives 9.2 and 9.1)
The String Class
Important Facts About Strings and Memory
Important Methods in the String Class
The StringBuilder Class
Important Methods in the StringBuilder Class
Working with Calendar Data (OCA Objective 9.3)
Immutability
Factory Classes
Using and Manipulating Dates and Times
Formatting Dates and Times
Using Arrays (OCA Objectives 4.1 and 4.2)
Declaring an Array
Constructing an Array
Initializing an Array
Using ArrayLists and Wrappers (OCA Objectives 9.4 and 2.5)
When to Use ArrayLists
ArrayList Methods in Action
Important Methods in the ArrayList Class
Autoboxing with ArrayLists
The Java 7 “Diamond” Syntax
Advanced Encapsulation (OCA Objective 6.5)
Encapsulation for Reference Variables
Using Simple Lambdas (OCA Objective 9.5)
Certification Summary
Two-Minute Drill
Q&A Self Test
Self Test Answers
A About the Download
System Requirements
Downloading from McGraw-Hill Professional’s Media Center
Installing the Practice Exam Software
Running the Practice Exam Software
Practice Exam Software Features
Removing Installation
Help
Technical Support
Windows 8 Troubleshooting
McGraw-Hill Education Content Support
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
OCA Java® SE 8 Programmer I Exam Guide (Exam 1Z0-808)
Next
Next Chapter
OCA Java® SE 8 Programmer I Exam Guide (Exam 1Z0-808)
For Andi
For Bob
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset