EC27 - Advanced Java Programming - 5 Days

Course Description

This course is aimed at existing Java developers who wish to obtain a deeper understanding of advanced Java programming techniques, APIs, and development practices.


Pre-requisites

Delegates should have at least 6 months solid Java experience.


Objectives

On completion of this course the student will be able to:

  • Exceptions and assertions
  • File handling and NIO2
  • Database access
  • Multithreading and concurrency
  • Localization and resource bundles


Environment

Development will be performed using:

  • Eclipse
  • IntelliJ
  • NetBeans
  • JBuilder


Customisation

For on-site courses (i.e. at your premises), we are more than happy to tailor the course agenda to suit your exact requirements. In many cases, we are able to build your in-house standards and naming conventions into the delivered course.


Course Details

CONVERSION, FORMATTING AND PRECISION
Data Type Conversion
Wrapper Classes
Autoboxing and Unboxing
Decimal Precision
Numeric Formatting
Other Formatting Techniques
Varargs
Type-safe enumerations
Static imports

ADVANCED CLASS DESIGN
Review - Access Modifiers
Review - Hiding Static Methods
Review - Overriding / Hiding Methods Summary
Review - Hiding Variables
Review - Method Overloading - Which Method?
Review - Method Overriding - Which Method?
Virtual Method Invocation
Annotation of Method Overrides
Overriding Methods in java.lang.Object
Overriding Equals and HashCode
Enums
Enum Example
Using Enums with witch / Case Statements
Defining Enums within Classes
Adding Constructors, Fields and Methods to Enums
Using Abstract Methods within Enums
Nested Classes
Member Inner Classes
Referencing the Outer Members from the Inner class
Example of Inner Class In Use
Using Inner Interfaces within Inner Classes
Method-Local Inner Classes
Anonymous Inner classes
Implementing Interfaces with Anonymous Inner Classes
Anonymous Inner Classes within Method calls
Static Nested Classes
Nested Class Summary

DESIGN PATTERNS AND PRINCIPLES
Interfaces
Defining an Interface
Implementing Methods
Interfaces with Static Variables and Methods
Interfaces with Default Methods - Java 8
Interface Methods vs Instance Methods - Rules
Duplicate Interface Methods - Rules
Functional Interfaces - Java 8
Using Lambda Expressions with Functional Interfaces
Lambda Expressions - Examples
Functional Interfaces and Generics
Built-In Functional Interfaces
Built-In Functional Interfaces - Predicates
Built-In Functional Interfaces - Functions
Other Built-In Functional Interfaces
Polymorphism Recap
Encapsulation Recap
JavaBean Syntax
Is-a and Has-a Relationships
Java Singleton Class Pattern
Singleton Class - Creating Unique Singletons
Single Classes with Double Checked Locking
Creating Immutable Objects
Creating Objects using the Builder Pattern
Creating Objects using the Factory Pattern

GENERICS AND COLLECTIONS
Recap - Arrays
Recap - Lists - The ArrayList Class
Generics
Parameterised Collections
Coding Generic Classes and Interfaces
Generic Restrictions
Coding Generic Methods
Generics - ClassCastException Errors
Generic Bounds
Unbounded Wildcard
Upper-Bounded Wildcards
Lower-Bounded Wildcards
Generic Bounds - Examples
Collection Interfaces
Summary Of Collection Implementations (Classes)
Commonly Used Collection Methods
Working With Lists
List Methods
Additional ArrayList Methods
Additional LinkedList Methods
Traversing Collections
Working With Sets
Sets - Set Methods
SortedSet Methods
NavigableSet Methods
Working With Queues
Working With Maps
Maps - Map Methods
Java 8 New Map Methods
Sorting -The Comparable Interface - Natural Ordering
Sorting - Comparators - Non Natural Ordering
Sorting Using the Comparator Interface - pre Java 8
Sorting Using the Comparator Interface - Lambda
Using Method References within Lambdas
Sorting and Searching Collections
Using Functional Interfaces to Process Collections

BUILT-IN FUNCTIONAL INTERFACES
Built-In Functional Interfaces
Functional Interfaces - Default and Static Methods
Method References Recap
Functional Interface - Supplier
Functional Interfaces - Consumer and BiConsumer
Functional Interfaces - Predicate and BiPredicate
Functional Interfaces - Function and BiFunction
Interfaces - UnaryOperator and BinaryOperator
Built-In Functional Interfaces - Returning an Optional
Using Streams
Creating Finite and Infinite Streams
Intermediate and Terminal Stream Operations
Terminal Operations
Intermediate Operations
Stream Pipelining
Streams with Primitive Data
Using Optional With Primitive Streams
Stream Mapping
Summarising Statistics
Built-In Functional Interfaces for Primitives
Stream Collection Techniques

DATES, STRINGS AND LOCALIZATION
Date Processing - Java 8 - The Need for Change
Creating Dates and Times
User Defined Dates
Java 8 - Working with TimeZones
Java 8 - Manipulating Dates and Times
Java 8 - Manipulating Dates and Times with ChronoUnit
Java 8 - Working with Periods and Durations
Durations
Java 8 - Date Manipulation
Java 8 - Working with Instants
Java 8 - Daylight Savings Time
Locale - Internationalization and Localization
Using a Resource Bundle / Properties File
Using a Resource Bundle / Properties Class
Formatting Numbers, Dates and Times using a Locale
Parsing Numeric Strings using a Locale
Java 8 - Date and Time Formatting

EXCEPTIONS AND ASSERTIONS
Java Exceptions
Error, Exception and RuntimeException Classes
Common Exception Types
User Defined Exceptions
Try / Catch Processing
The Finally Block
Passing Exceptions Up the Stack the Throws clause
The Throw Statement
Rethrowing Exceptions
Multi-Catch Blocks
Try-With-Resources
Using the AutoCloseable Interface
Suppressed Exceptions (Secondary Exceptions)
Using System.exit() to Terminate
The Assert Statement

CONCURRENCY
What is a Thread?
Creating Threads
Creating Threads - Technique 1
Creating Threads - Technique 2
Runnable - Functional Interface
Thread Priority
Thread Polling
Terminating Threads
Daemon Threads
Java Concurrency API
The Single Thread Executor
Shutting Down the Executor
Submitting Tasks to the ExecutorService
Checking the Results using Future
The Callable Interface
Callable vs Runnable vs Supplier
Waiting For All Tasks To Finish
Scheduling Tasks - ScheduledExecutorService
Thread Pools
Synchronizing Data Access - Atomic Classes
Synchronizing Data Access - Synchronized Blocks
Synchronizing Data Access - Synchronized Methods
Concurrent Collections
Concurrent Collections - BlockingQueue
Concurrent Collections - BlockingDeque
Concurrent Collections - CopyOnWrite Classes
Concurrent Collections - Converting to Synchronized
Parallel Streams
Parallel Stream Performance
Parallel Ordering
Problems with Stateful Operations
Parallel Reductions
Combining Streams with Reduce
Combining Streams with Collect
Managing Concurrent Processes
Threading Problems

I/O
Unicode Overview
Character Conversion Terminology
Code Page Differences
How Unicode Works
Class java.io.File
File Streams
I/O Stream Classes
I/O Stream Class Inheritance
High Level Wrapper Examples
Common Stream Operations
FileInputStream and FileOutputStream
BufferedInputStream and BufferedOutputStream
FileReader / Writer and BufferedReader / Writer
Character Encoding
Serialization - ObjectOutputStream
Deserialization - ObjectInputStream
Serialization - Versioning
PrintStream and PrintWriter Classes
PrintWriter Example
PrintStream Example
PrintWriter / PrintStream Character Encoding
PrintWriter / PrintStream - String Formatting
Interacting With Users

NIO.2
Reasons for NIO.2
Class java.nio.file.Path
Creating a Path using the Paths Factory
Creating a Path using FileSystem
Non Local Path References
Legacy Path References using java.io.File
Common Path Methods
Path Method Examples
Relative Path Processing - The Relativize Method
Joining Paths - The Resolve Method
Checking for Path Existence - The ToRealPath Method
Using Symbolic Links
Class java.nio.file.Files
Files - Existence and Attributes
Files - Attribute Modification
Comparison of legacy File and NIO.2 methods
Using File Views
Files - Making Directories
Common Optional Arguments used within NIO.2 Methods
Files - Copying a Path
Files - Copying File Contents using Streams
Files - Moving (renaming) A Path
Files - Delete a File or Empty Directory
Using Files.newBufferedReader() / Writer()
Files - Read All Lines from a File
Directory Walking with Functional Streams

JDBC
Database Sample Data
Basic SQL Statement Review
Java Database Introduction
JDBC Drivers and Interfaces
Getting A Database Connection
Locating the Driver
Creating A Statement
Executing Statements
Executing Statements - Update Example
Processing ResultSet Data
Processing ResultSet Date, Time and Timestamp Data
Cursor Operations
Scrollable Cursors
ResultSet - Cursor Scroll Types
Cursor Concurrency Types
Cursor Holdibility Types - (Not Covered on OCP Exam)
ResultSet - Scrollable Cursor Example
Closing Connections
Handling SQL Errors
Handling SQL Warnings

REFLECTION
Dynamic retrieval of information using reflection
Creating instances of extensibility objects
Class fields, methods and constructors

OVERVIEW OF JAVA EE
Java EE architecture
Web technologies
Servlets and JSPs


Course Enquiry