Java OCP II Training Course >>

Java OCP II

Who will benefit

Duration

Price

What do I need?

Outcomes

Certification

Contents

OCP II

1 Introduction

  • Course Objectives 
  • Introductions 
  • Audience 
  • Prerequisites
  • Course Roadmap
  • Lesson Format
  • Practice Environment
  • How Do You Learn More After the Course? 
  • Additional Resources 

2 Java OOP Review

  • Objectives 
  • Java Language Review 
  • A Simple Java Class: Employee 
  • Encapsulation: Private Data, Public Methods 
  • Subclassing 
  • Constructors in Subclasses 
  • Using super 
  • Using Access Control 
  • Protected Access Control: Example 
  • Inheritance: Accessibility of Overriding Methods 
  • Final Methods 
  • Final Classes
  • Applying Polymorphism 
  • Overriding methods of Object Class 
  • Overriding methods of Object Class: toString Method 
  • Overriding methods of Object Class: equals Method 
  • Overriding methods of Object Class: hashCode Method 
  • Casting Object References 
  • Upward Casting Rules 
  • Downward Casting Rules 
  • Methods Using Variable Arguments 
  • Static Imports 
  • Nested Classes 
  • Example: Member Class 
  • What Are Enums? 
  • Complex Enums 
  • Methods in Enums 
  • Summary 
     

3 Exception Handling and Assertions

  • Objectives 
  • Error Handling 
  • Exception Types 
  • Exception Handling Techniques in Java 
  • Exception Handling Techniques: try Block 
  • Exception Handling Techniques: finally Clause 
  • Exception Handling Techniques: try-with-resources 
  • Exception Handling Techniques: try-with-resources Improvements 
  • Exception Handling Techniques: | operator in a catch block 
  • Exception Handling Techniques: Declaring Exceptions 
  • Creating Custom Exceptions 
  • Assertions 
  • Assertion Syntax 
  • Internal Invariants 
  • Control Flow Invariants 
  • Class Invariants 
  • Controlling Runtime Evaluation of Assertions 
     

4 Java Interfaces

  • Objectives 
  • Java Interfaces 
  • Java SE 7 Interfaces 
  • Implementing Java SE 7 Interface Methods 
  • Example: Implementing abstract Methods 
  • Example: Duplicating Logic 
  • Implementing Methods in Interfaces 
  • Example: Implementing default Methods 
  • Example: Inheriting default Methods 
  • Example: Overriding a default Method 
  • What About the Problems of Multiple Inheritance?
  • Inheritance Rules of default Methods 
  • Interfaces Don't Replace Abstract Classes 
  • What If default Methods Duplicate Logic? 
  • Duplication Between default Methods 
  • The Problem with This Approach 
  • Introducing private Methods in Interfaces 
  • Example: Using private Methods to Reduce Duplication Between
  • default Methods 
  • Types of Methods in Java SE 9 Interfaces 
  • Anonymous Inner Classes 
  • Anonymous Inner Class: Example 
     

5 Collections and Generics

  • Objectives 
  • Type-Wrapper Classes 
  • Autoboxing and Auto-Unboxing 
  • Generic Methods 
  • A Generic Method 
  • Generic Classes 
  • Generic Cache Class 
  • Testing the Generic Cache Class 
  • Generics with Type Inference Diamond Notation 
  • Java SE 9: Diamond Notation with Anonymous Inner Classes 
  • Collections 
  • Collections Framework in Java 
  • Benefits of the Collections Framework 
  • Collection Types 
  • Key Collections Interfaces 
  • ArrayList 
  • ArrayList Without Generics
  • Generic ArrayList 
  • TreeSet: Implementation of Set 
  • Map Interface 
  • TreeMap: Implementation of Map 
  • Stack with Deque: Example 
  • Ordering Collections 
  • Comparable: Example 
  • Comparable Test: Example 
  • Comparator Interface 
  • Comparator: Example 
  • Comparator Test: Example 
  • Wildcards 
  • Wildcards: Upper Bound 
  • Why Use Generics? 
  • Java SE 9: Convenience Methods for Collections 
  • of Convenience Method 
  • Overloading of Method 
  • ofEntries Method for Maps 
  • Features of Convenience Methods 
     

6 Functional Interfaces and Lambda Expressions

  • Objectives 
  • Problem Statement 
  • RoboCall Class
  • RoboCall Every Person 
  • RoboCall Use Case: Eligible Drivers 
  • RoboCall Use Case: Eligible Voters 
  • RoboCall Use Case: Legal Drinking Age 
  • Solution: Parameterization of Values 
  • Solution: Parameterized Methods 
  • Parameters for Age Range 
  • Using Parameters for Age Range 
  • Corrected Use Case 
  • Parameterized Computation 
  • How To Pass a Function in Java? 
  • Prior to Java SE 8: Pass a Function Wrapped in an Object
  • Prior to SE 8: Abstract Behavior With an Interface 
  • Prior to SE 8: Replace Implementation Class with Anonymous Inner Class 
  • Lambda Solution: Replace Anonymous Inner Class with Lambda Expression 
  • Rewriting the Use Cases Using Lambda 
  • What Is a Lambda? 
  • What is a Functional Interface 
  • Which of These Interfaces Are Functional Interfaces? 
  • Lambda Expression 
  • Using Lambdas
  • Which of The Following Are Valid Lambda Expressions? 
  • Lambda Expression: Type Inference 
  • To Create a Lambda Expression 
  • Examples of Lambdas
  • Statement Lambdas: Lambda with Body
  • Examples: Lambda Expression 
  • Lambda Parameters 
  • Local-Variable Syntax for Lambda Parameters
  • Functional Interfaces: Predicate 
  • Using Functional Interfaces 


7 Collections, Streams, and Filters

  • Objectives 
  • Collections, Streams, and Filters 
  • The RoboCall App 
  • Collection Iteration and Lambdas 
  • RoboCallTest07: Stream and Filter 
  • Stream and Filter 
  • RobocallTest08: Stream and Filter Again 
  • SalesTxn Class 
  • Java Streams 
  • The Filter Method 
  • Filter and SalesTxn Method Call 
  • Method References 
  • Method Chaining 
  • Pipeline Defined 


8 Lambda Built-in Functional Interfaces

  • Objectives 
  • Built-in Functional Interfaces 
  • The java.util.function Package 
  • Example Assumptions 
  • Predicate 
  • Predicate: Example 
  • Consumer 
  • Consumer: Example 
  • Function 
  • Function: Example 
  • Supplier 
  • Supplier: Example 
  • Primitive Interface 
  • Return a Primitive Type 
  • Return a Primitive Type: Example 
  • Process a Primitive Type 
  • Process Primitive Type: Example 
  • Binary Types 
  • Binary Type: Example 
  • Unary Operator 
  • UnaryOperator: Example 
  • Wildcard Generics Review 
  • A Closer Look at Consumer
  • Interface List<E> use of forEach method 
  • Example of Range of Valid Parameters 
  • Plant Class Example 
  • TropicalFruit Class Example 
  • Use of Generic Expressions and Wildcards 
  • Consumer andThen method 
  • Using Consumer.andThen method 
     

9 Lambda Operations

  • Objectives 
  • Streams API 
  • Types of Operations 
  • Extracting Data with Map 
  • Taking a Peek 
  • Search Methods: Overview 
  • Search Methods 
  • Optional Class 
  • Short-Circuiting Example 
  • Stream Data Methods 
  • Performing Calculations 
  • Sorting 
  • Comparator Updates 
  • Saving Data from a Stream 
  • Collectors Class 
  • Quick Streams with Stream.of
  • Flatten Data with flatMap 
  • flatMap in Action 


10 The Module System

  • Objectives 
  • Module System 
  • Module System: Advantages 
  • Java Modular Applications 
  • What Is a Module? 
  • A Modular Java Application 
  • Issues with Access Across Nonmodular JARs 
  • Dependencies Across Modules 
  • What Is a Module? 
  • Module Dependencies with requires 
  • Module Package Availability with exports 
  • Module Graph 1 
  • Module Graph 2 
  • Transitive Dependencies 
  • Access to Types via Reflection 
  • Example Hello World Modular Application Code 
  • Example Hello World Modular File Structure 
  • Compiling a Modular Application
  • Single Module Compilation Example 
  • Multi Module Compilation Example 
  • Creating a Modular JAR 
  • Running a Modular Application
  • The Modular JDK 
  • Java SE Modules
  • The Base Module
  • Finding the Right Platform Module
  • Illegal Access to JDK Internals in JDK 9
  • What Is a Custom Runtime Image?
  • Link Time 
  • Using jlink to Create a Runtime Image 
  • Example: Using jlink to Create a Runtime Image 
  • Examining the Generated Image 
  • Modules Resolved in a Custom Runtime Image 
  • Advantages of a Custom Runtime Image 
  • JIMAGE Format 
  • Running the Application 
     

11 Migrating to a Modular Application

  • Objectives 
  • Topics 
  • The League Application 
  • Run the Application
  • The Unnamed Module 
  • Topics 
  • Top-down Migration and Automatic Modules 
  • Automatic Module 
  • Top-Down Migration 
  • Creating module-info.java—Determining Dependencies
  • Check Dependencies 
  • Library JAR to Automatic Module 
  • Typical Application Modularized 
  • Topics 
  • Bottom-up Migration 
  • Bottom-Up Migration 
  • Modularized Library 
  • Run Bottom-Up Migrated Application 
  • Fully Modularized Application 
  • Module Resolution 
  • Topics 
  • More About Libraries 
  • Run Application with Jackson Libraries 
  • Open Soccer to Reflection from Jackson Libraries 
  • Topics 
  • Split Packages 
  • Splitting a Java 8 Application into Modules 
  • Java SE 8 Application Poorly Designed with Split Packages 
  • Migration of Split Package JARs to Java SE 9 
  • Addressing Split Packages
  • Topics 
  • Cyclic Dependencies 
  • Addressing Cyclic Dependency 1 
  • Addressing Cyclic Dependency 2 
  • Top-down or Bottom-up Migration Summary 
12 Services in a Modular Application

  • Objectives
  • Topics 
  • Modules and Services 
  • Components of a Service 
  • Produce and Consume Services 
  • Module Dependencies Without Services 
  • Service Relationships 
  • Expressing Service Relationships 
  • Topics 
  • Using the Service Type in competition 
  • Choosing a Provider Class 
  • Module Dependencies and Services 1 
  • Module Dependencies and Services 2
  • Module Dependencies and Services 3 
  • Designing a Service Type 
  • Topics 
  • TeamGameManager Application with Additional Services 
  • module-info.java for competition module 
  • module-info.java for league and knockout modules 
  • module-info.java for soccer and basketball modules 


13 Concurrency

  • Objectives 
  • Task Scheduling 
  • Legacy Thread and Runnable 
  • Extending Thread 
  • Implementing Runnable 
  • The java.util.concurrent Package 
  • Recommended Threading Classes 
  • java.util.concurrent.ExecutorService 
  • Example ExecutorService 
  • Shutting Down an ExecutorService 
  • java.util.concurrent.Callable 
  • Example Callable Task 
  • java.util.concurrent.Future 
  • Example 
  • Threading Concerns 
  • Shared Data 
  • Problems with Shared Data 
  • Nonshared Data 
  • Atomic Operations 
  • Out-of-Order Execution 
  • The synchronized Keyword 
  • synchronized Methods 
  • synchronized Blocks 
  • Object Monitor Locking 
  • Threading Performance 
  • Performance Issue: Examples 
  • java.util.concurrent Classes and Packages 
  • The java.util.concurrent.atomic Package 
  • java.util.concurrent.CyclicBarrier 
  • Thread-Safe Collections 
  • CopyOnWriteArrayList: Example 


14 Parallel Streams

  • Objectives
  • Streams Review 
  • Old Style Collection Processing 
  • New Style Collection Processing 
  • Stream Pipeline: Another Look 
  • Styles Compared 
  • Parallel Stream 
  • Using Parallel Streams: Collection 
  • Using Parallel Streams: From a Stream 
  • Pipelines Fine Print
  • Embrace Statelessness 
  • Avoid Statefulness 
  • Streams Are Deterministic for Most Part 
  • Some Are Not Deterministic 
  • Reduction 
  • Reduction Fine Print 
  • Reduction: Example
  • A Look Under the Hood 
  • Illustrating Parallel Execution 
  • Performance
  • A Simple Performance Model 


15 Terminal Operations: Collectors

  • Objectives 
  • Agenda 
  • Streams and Collectors Versus Imperative Code 
  • Predefined Collectors 
  • A Simple Collector 
  • A More Complex Collector
  • Agenda 
  • The Three Argument collect Method of Stream 
  • The collect Method Used with a Sequential Stream 
  • The collect Method Used with a Parallel Stream 
  • The collect Method: Collect to an ArrayList Example 
  • Agenda 
  • The Single Argument collect Method of Stream 
  • Using Predefined Collectors From the Collectors Class 
  • List of Predefined Collectors 
  • Stand-Alone Collectors 
  • Stand-Alone Collector:List all Elements 
  • maxBy() Example 
  • Adapting Collector: filtering() 
  • Composing Collectors : groupingBy() 
  • Composing Collectors: Using Mapping 
  • toMap() and Duplicate Keys 
  • Agenda
  • groupingBy and partitioningBy Collectors 
  • Stand-Alone groupingBy: Person Elements By City 
  • Stream Operations Or Equivalent Collectors? 
  • Stream Operations Or Equivalent Collectors with groupingBy 
  • Stream.count(), Collectors.counting and groupingBy 
  • Composing Collectors: Tallest in Each City 
  • groupingBy: Additional Processing with entrySet() 
  • Agenda
  • Nested Values 
  • Data Organization of ComplexSalesTxn 
  • Displaying Nested Values: Listing Line Items in Each Transaction 
  • Displaying Nested Values: Listing Line items 
  • Displaying Nested Values: Grouping LineItem elements 
  • groupingBy Examples for ComplexSalesTxn 
  • Group Items by Salesperson 
  • Agenda 
  • Complex Custom Collectors 
  • The collect Method: Using a Custom Collector 
  • Creating a Custom Collector: Methods to Implement 
  • Custom Example MyCustomCollector 
  • Finisher Example MyCustomCollector
  • A More Complex Collector 
  • A More Complex Collector CustomGroupingBy 


16 Creating Custom Streams

  • Objectives 
  • Topics 
  • Performance: Intuition and Measurement 
  • Parallel Versus Sequential Example 
  • Spliterator 
  • Decomposition with trySplit() 
  • Integration with Streams
  • Modifying LongStream Spliterator 
  • Spliterator TestSpliterator 
  • Using TestSpliterator 
  • Topics
  • Creating a Custom Spliterator 
  • Is a Custom Spliterator Needed for a Game Engine? 
  • A Tic-Tac-Toe Engine Using the map Method of Stream 
  • A Custom Spliterator Example for a Custom Collection 
  • Custom N-ary Tree 
  • Possible Implementation for NaryTreeSpliterator 
  • Stream<Node> in Use 
  • Implementing Parallel Processing 
  • Stream<Node> in Use 
  • Summary of NTreeAsListSpliterator 


17 Java I/O Fundamentals and File I/O (NIO.2)

  • Objectives 
  • Java I/O Basics 
  • I/O Streams 
  • I/O Application 
  • Data Within Streams 
  • Byte Stream InputStream Methods 
  • Byte Stream: Example 
  • Character Stream Methods 
  • Character Stream: Example 
  • I/O Stream Chaining 
  • Chained Streams: Example 
  • Console I/O 
  • Writing to Standard Output 
  • Reading from Standard Input 
  • Channel I/O 
  • Persistence 
  • Serialization and Object Graphs 
  • Transient Fields and Objects 
  • Transient: Example 
  • Serial Version UID 
  • Serialization: Example 
  • Writing and Reading an Object Stream 
  • Serialization Methods 
  • readObject: Example 
  • New File I/O API (NIO.2) 
  • Limitations of java.io.File 
  • File Systems, Paths, Files 
  • Relative Path Versus Absolute Path 
  • Java NIO.2 Concepts 
  • Path Interface 
  • Path Interface Features 
  • Path: Example 
  • Removing Redundancies from a Path 
  • Creating a Subpath 
  • Joining Two Paths 
  • Symbolic Links 
  • Working with Links 
  • File Operations
  • BufferedReader File Stream 
  • NIO File Stream 
  • Read File into ArrayList 
  • Managing Metadata 


18 Secure Coding Guidelines

  • Objectives 
  • Java SE Security Overview 
  • Secure Coding Guidelines 
  • Vulnerabilities 
  • Secure Coding Antipatterns 
  • Antipatterns in Java 
  • Fundamentals 
  • Fundamentals: Why Should I Care? 
  • Denial of Service 
  • Confidential Information 
  • Injection and Inclusion 
  • Accessibility and Extensibility 
  • Input Validation 
  • Mutability 
  • Object Construction 
  • Serialization and Deserialization 


19 Building Database Applications with JDBC

  • Objectives 
  • What Is the JDBC API? 
  • What Is JDBC Driver? 
  • Connecting to a Database 
  • Obtaining a JDBC Driver 
  • Register the JDBC driver with the DriverManager 
  • Constructing a Connection URL 
  • Establishing a Connection 
  • Using the JDBC API 
  • Key JDBC API Components 
  • Writing Queries and Getting Results 
  • Using a ResultSet Object 
  • CRUD Operations Using JDBC API: Retrieve 
  • CRUD Operations Using JDBC: Retrieve 
  • CRUD Operations Using JDBC API: Create 
  • CRUD Operations Using JDBC API: Update 
  • CRUD Operations Using JDBC API: Delete 
  • SQLException Class 
  • Closing JDBC Objects 
  • try-with-resources Construct 
  • Using PreparedStatement 
  • Using PreparedStatement: Setting Parameters 
  • Executing PreparedStatement 
  • PreparedStatement:Using a Loop to Set Values 
  • Using CallableStatement 


20 Localization

  • Objectives 
  • Why Localize? 
  • A Sample Application 
  • Locale 
  • Properties 
  • Loading and Using a Properties File 
  • Loading Properties from the Command Line 
  • Resource Bundle 
  • Resource Bundle File 
  • Sample Resource Bundle Files 
  • Initializing the Sample Application 
  • Sample Application: Main Loop
  • The printMenu Method 
  • Changing the Locale
  • Sample Interface with French 
  • Format Date and Currency 
  • Displaying Currency 
  • Formatting Currency with NumberFormat 
  • Displaying Dates 2
  • Displaying Dates with DateTimeFormatter 
  • Format Styles 

Avoid disappointment

Book Now!