Java 21 Training Overview
This Java Eclipse training course teaches learners the foundational skills to begin programming with Java. This hands-on course focuses on practical application, teaching learners to write, compile, and execute Java programs. Learners master the Eclipse IDE, Java syntax, object-oriented programming principles, and standard Java development techniques.
Location and Pricing
Accelebrate offers instructor-led enterprise training for groups of 3 or more online or at your site. Most Accelebrate classes can be flexibly scheduled for your group, including delivery in half-day segments across a week or set of weeks. To receive a customized proposal and price quote for private corporate training on-site or online, please contact us.
In addition, some courses are available as live, instructor-led training from one of our partners.
Objectives
- Understand core concepts of Java programming
- Use Java development tools and the Eclipse IDE
- Apply object-oriented programming principles in Java
- Write Java code using essential syntax, data types, and control structures
- Create and manipulate classes, objects, and inheritance hierarchies
- Implement exception handling, interfaces, and polymorphism
- Leverage Java classes and libraries for common tasks
- Perform input/output operations and file handling
- Explore additional Java features like annotations, assertions, and generics
Prerequisites
Familiarity with object-oriented programming is beneficial but not required.
Outline
Expand All | Collapse All
Overview of Java
- History Of Java
- Java Release Cycle
- Benefits Of Java
- What Is Java?
- What's This "Virtual Machine"?
- Comparison to Other Languages
- Java Programs
- Basic Java Development Tools
- Java Editions
- Example – HelloWorld
- Java Classes
- Main Methods
- Statements
Java Tools in Eclipse
- Eclipse Platform
- Eclipse Workspace
- Perspectives, Views & Editors
- Basic Operations with Eclipse Views and Perspectives
- The Java Perspective
- The Debug Perspective
- Navigator View
- Package Explorer
- Outline View
- Problems View
- Eclipse Preferences
- Build and Validation
- Code Completion, Templates and Snippets
- Searching
- Configure Compiler Class Path
- JRE Switching
Basic Object Concepts
- What Is An Object?
- State
- Behavior
- Encapsulation
- Encapsulation Examples
- Classes vs. Objects
- Inheritance
- Interfaces
- Polymorphism
- Benefits Of Objects
Basic Java Syntax
- Declaring And Initializing Variables
- Keywords
- Coding Tips – Variables
- Primitive Data Types
- Logical - boolean
- Textual - char and String
- Integral - byte, short, int, long
- Floating Point - float and double
- Numeric Literals
- Strings
- Creating Strings
- White Space
- Comments
- Coding Tips - Comments
- Java Statements
- Coding Tips - Statements
- Scope of a Variable
- Local Variable Type Inference
- System.out/System.in
- Scanner Class
Operations and Making Decisions
- Operator Categories
- Special Situations
- Binary Operators
- Integer Division
- Numeric Promotion
- Type Conversion Of Primitive Types
- Unary Operators
- Relational Operators
- Logical Operators
- "Short Circuited" Operators
- Bitwise Operators
- Shift Operators
- Overflow And Underflow
- Assignment Operators
- Ternary Operator
- Calculation Errors
- Operator Precedence
- Precedence Examples
- Combining Strings
- Coding Tips - Operators
- Control Flow Statements
- 'if' Statement
- 'if…else' Statement
- Nested Statements
- Coding Tips - if & if-else
Using Classes and Objects
- Objects, Instances, And Classes
- What Are Classes?
- Working With Classes And Objects
- Instantiation
- Instance Methods
- Object References
- Null Values
- String Operations
- "Wrapper" Classes
- Autoboxing
Writing Classes
- Why Define Your Own Classes?
- Encapsulation
- Elements Of A Class
- Defining Classes
- Coding Tips - Class Definitions
- Fields
- Defining Fields
- Coding Tips - Fields
- Methods
- Defining Methods
- Passing Parameters
- Overloading Methods
- Coding Tips - Methods
- Local Variables vs. Instance Variables
- Example - Defining a Class
- Example - Fields
- Example - Defining a Method
- Example - Calling a Method
Controlling Code Access and Code Organization
- Controlling Access
- Data Hiding
- Encapsulation
- JavaBeans
- Packages
- Naming Packages
- Declaring Packages In Classes
- Problems Solved With Packages
- Package Access
- Example - Access Modifiers
- Import Statement
- Using Classes From Packages
- Coding Tips - Import Statements
- Correlation To File Structure
- Class Path
- Java Core Packages
- Java Module System
- Java API Documentation
Constructors and Class Members
- Constructors
- Default Constructor
- Multiple Constructors
- Defining Constructors
- Example - Calling Constructors
- "Good" Constructors
- 'this' Keyword
- Using 'this' to Call a Constructor
- Using 'this' to Set a Field
- Class Members
- Examples Of Class Members
- Comparison With Instance Members
- Use Of Class Variables
- Static Class Methods
- Use Of Class Methods
- The Math Class
- Main Method And Command Line Arguments
- Declaring Constants
- Coding Tips - Class Members
- Useful Standard Class Members
Java Records
- Java Records
- Records vs. Classes
- Records - Example Definitions
- Records - Example Usage
- Auto-generated Elements in Records
- Overriding Auto-Generated Methods
- Overriding the Implicit Constructor
- When to use Java Records
- When NOT to use Java Records
- Additional Facts about Records
Advanced Control Structures
- 'switch' Statement
- Switch Features
- Example: Switch on int expression
- Example: Switch on String expression
- Example: Switch on Object type
- Example: Switch on Object Attributes
- Example: Switch on RegEx Match
- Switch "Fall Through"
- 'for' Loop
- 'while' Loop
- 'do…while' Loop
- Break Statement
- Labeled Statements
- Continue Statement
- Example - continue
- Example - Labeled continue
- Coding Tips - Control Structures
Inheritance
- Inheritance Is…
- Inheritance Examples
- Declaring Inheritance
- Inheritance Hierarchy
- Access Modifiers Revisited
- Inherited Members
- Instances Of A Subclass
- Example Of Inheritance
- Role In Reuse
- Overriding Methods
- @Override Annotation
- The super Keyword
- Problems with Constructors
- Limiting Subclasses
- Calling Methods in Constructors
- The Object Class
Sealed Classes
- What are Sealed Classes?
- The Benefits of Sealed Classes
- Features of Sealed Classes
- Sealed Class Rules
- Sealed Class Syntax
- Sealed Interfaces
- Use Cases for Sealed Classes
Arrays
- Declaring Arrays
- Populating Arrays
- Accessing Arrays
- Arrays of Objects
- Array Length
- Coding Tips - Arrays
- Array References
- Multidimensional Arrays
- Arrays Of Arrays
- Copying Arrays
- For-Each loop
- Command Line Arguments
- Variable Arguments
Commonly Overridden Methods
- Overriding Methods
- Using Eclipse to Override Methods
- toString()
- toString() in Object
- Overriding toString()
- Comparing Objects
- Using == vs. equals(..)
- Overriding equals(..)
- Complex Comparisons
- equals(..) Example
- hashCode()
- Overriding hashCode()
- hashCode() Example
- Generating equals and hashCode
Exceptions
- What is an Exception?
- Benefits
- The java.lang.Exception Class
- How to Work With Exceptions
- Example Exception Handling
- The try-catch-finally Statement
- Flow of Program Control
- Exception Hierarchy
- Checked Exceptions
- Unchecked Exceptions
- Coding Tips - Exception Types
- Catching Subclass Exceptions
- Catching Multiple Exceptions
- Specifying Thrown Exceptions
- Rethrowing Exceptions
- Chaining Exceptions
- Creating your own Exception
- try-with-resources Statement
- Suppressed Exceptions in try-with-resources
Interfaces and Polymorphism
- Casting Objects
- The instanceof Operator
- Abstract Classes
- Abstract Class – An Example
- Interface
- Comparable Interface
- Default Methods
- Static Methods
- Private Interface Methods
- Coding Tips - Superclass or Abstract Class/Interface?
- Coding Tips – Abstract Class or Interface
- Polymorphism
- Conditions for Polymorphism
- Coding Tips - Leveraging Polymorphism
- Covariant Return Types
- Covariant Return Types – An Example
- Summary
Useful Java Classes
- Java Logging API
- Control Flow of Logging
- Logging Levels
- Loggers
- Logging Example
- Logging Handlers
- Logging Formatters & Log Manager
- Logging Configuration File
- Example Logging Configuration File
- Logging Filters
- java.lang.StringBuilder
- java.util.StringTokenizer
- java.util.Arrays & java.util.Collections
- java.util.Random
- Java Date and Time
- Local Date and Time
- java.util.Date and java.time.Instant
- Formatting
- Formatting Example
Collections and Generics
- What are Collections?
- Arrays vs. Collections
- Main Collections Interfaces
- java.util.Collection
- Main Collection Methods
- Sets
- java.util.List
- java.util.Queue
- Iteration on a Collection
- Iterator vs. For-Each Loop
- Maps
- Collections Implementations
- Abstract Implementations
- Choosing a Collection Type
- Generics
- Generics and Collections
- Generic Collection Example
- Generic Collection Example
- Collections and Primitive Types
- Generic Diamond Operator
- Collection Factory Methods
Introduction to Lambda Expressions
- Functional Interface
- Anonymous Inner Class (AIC)
- Downside of AIC
- Lambda Expressions
- Lambda Expression Syntax
- Method Reference
- Benefits of Lambda Expressions – An Example
- Initial Version
- Refactor Criteria Into Method
- Predicate Interface
- Using a Predicate
- Implement as Separate Class
- Implement as AIC
- Use Lambda Expressions
- Reuse Lambda Expressions
Input and Output
- Overview of Java Input/Output
- The File Class
- File Example
- The java.nio.file.Path Interface
- Serialization
- Serializing Object State
- Avoiding Serialization Problems
- serialVersionUID
- Options for File Input/Output
- Streams
- Input Stream
- Output Stream
- "Chained" Streams
- RandomAccessFile
- try-with-resources Statement
- Using Streams - Write Example
- Using Streams - Read Example
- Reader and Writer
- Using Readers and Writers - Write Example
- Using Readers and Writers - Read Example
- Using Readers and Writers - Scanner Read Example
- NIO Channels and Buffers
Other Java Concepts
- Annotations
- Enumerated Types
- Assertions
- When to use Assertions
- Assertions Examples
- Enabling Assertions
- JVM Storage Areas
- Java Heap Space
- Heap Size Limits
- Garbage Collection Basics
- Allocation Failure (AF)
- OutOfMemoryError
- Memory Leak
- JShell
- Distributing Java Code with JARs
Appendix A - Overview of Java SE APIs
- Java GUI Programming
- Networking
- Security
- Date and Time API
- Databases - JDBC
- Concurrent Programming
- Collections “Stream API”
- Functional Interfaces for Lambda Expressions
- Naming - JNDI
- Management - JMX
- XML
- Remote Method Invocation
- Image I/O
- Printing
Appendix B - Overview of Java EE
- Goals of Enterprise Applications
- What is Java EE?
- The Java EE Specifications
- Versions
- Role of Application Server
- Java EE Components
- What is a Servlet?
- Servlet Execution
- What is a JSP?
- JSP Code Sample
- Introduction to JSF
- Example JSF Page
- What is an EJB?
- EJB Types
- Java Persistence API
- EJB Examples
- Java Web Services
- Contexts and Dependency Injection for Java EE (CDI)
- Web Browser
- Java EE Application Structure
- EAR File
- What are Modules?
Appendix C - Advanced Java Tools
- Refactoring
- Renaming Elements
- Moving a Class to a Different Package
- Extracting Code to a Method
- Other Source Code Refactoring
- Refactoring to Improve Type Hierarchy
- Generalizing a Variable
- Pull-up and Push-down
Conclusion
Training Materials
All Java training students receive comprehensive courseware.
Software Requirements
- A recent version of Windows, macOS, or Linux with at least 8 GB RAM
- JDK 21 or later
- Eclipse or IntelliJ IDEA
- Other free software - please contact us if you have purchased this class