The
Java
Workshop

Built by a team of experts to help you unlock your next promotion, reboot your career, or kick off your latest side project.

Get Started Today

You'll be up and running with Java development in no time at all.

  • $24.99

    $24.99The Java Workshop

    Unlock one year of full, unlimited access and get started right away!
    Learn for Free

Engineered for Success

Nobody likes going through hundreds of pages of dry theory, or struggling with uninteresting examples that don’t compile. We've got you covered. Any time, any device.

  • Learn by doing real-world development, supported by detailed step-by-step examples, screencasts and knowledge checks.

  • Become a verified practitioner, building your credentials by completing exercises, activities and assessment checks.

  • Manage your learning based on your personal schedule, with content structured to easily let you pause and progress at will.

Learn By Doing

You already know you want to learn Java, and the best way to learn Java is to learn by doing.

The Java Workshop focuses on building up your practical skills so that you can develop high-performance applications that work flawlessly within the JVM across web, mobile and desktop.

On Your Terms

Build up and reinforce key skills in a way that feels rewarding.

You won't have to sit through any unnecessary theory. If you're short on time you can jump into a single exercise each day or spend an entire weekend learning about Java's built-in APIs.

An Ideal Start

Fast-paced and direct, The Java Workshop is the ideal companion for newcomers.

You'll build and iterate on your code like a software developer, learning along the way. This process means that you'll find that your new skills stick, embedded as best practice. A solid foundation for the years ahead.

Begin Your Journey

A simple, straightforward and pain-free way to learn Java.

  • $24.99

    $24.99The Java Workshop

    Unlock one year of full, unlimited access and get started right away!
    Learn for Free

Everything You Need

Every Workshop includes access to dedicated support, course discussions and a wider learning community. Ask questions, share answers and work with the community to expand your learning.

  • Engage and participate in live user discussions, baked right into your course from start to finish. Share, learn and grow together.

  • Get live updates and interact directly with the product development, editorial and authoring teams across the Packt network.

  • Create, showcase and share your own learning outcomes and motivational stories across the entire workshop community.

Get Build-Ready

Every Workshop includes a whole host of features that work together to help you get the job done. You’ll be ready to tackle real-world development in no time.
  • Hack Your Brain

    We've applied the latest pedagogical techniques to deliver a truly multimodal experience. It'll keep you engaged and make the learning stick. It's science!

  • Build Real Things

    Nobody likes wasting their time. We cut right to the action and get you building real skills that real, working developers value. The perfect approach for a career move.

  • Learn From Experts

    We've paired technical experts with top editorial talent. They've worked hard to deliver you the maximum impact for each minute you spend learning. It's our secret sauce.

  • Verify Your Credentials

    You can become a verified practitioner. Complete the course to get a certificate. It's perfect for sharing on social media. Hello LinkedIn!

  • Receive Free Updates

    Technology keeps changing, and so do we. We keep versions updated independently, so you'll always have access. No more worrying about third-party release cycles.

  • Access Anywhere

    All you need is an internet connection. We've built every course so that it works on desktop and mobile, giving you options that fit within your schedule.

What's Inside

From A to Z, we've got you covered!

  • Workshop Onboarding

    • Welcome to The Java Workshop
    • Installation and Setup
    • Credits
  • 1. Getting Started

    • Overview
    • Writing, Compiling, and Executing Your Hello World Program
    • Exercise 1: Creating Your Hello World Program in Java
    • Exercise 1: Creating Your Hello World Program in Java
    • Basic Syntax and Naming Conventions
    • Exercise 2: Printing Different Types of Data
    • Exercise 2: Printing Different Types of Data
    • Primitive versus Reference Data Types
    • Exercise 3: Declaring Strings
    • Exercise 3: Declaring Strings
    • Doing Some Math
    • Exercise 4: Solving a Simple Trigonometry Problem
    • Exercise 4: Solving a Simple Trigonometry Problem
    • Comments Help You to Share Code
    • Exercise 5: Running the Code from the CLI
    • Exercise 5: Running the Code from the CLI
    • Activity 1: Obtaining the Minimum of Two Numbers
    • Summary
  • 2. Learning the Basics

    • Overview
    • Controlling the Flow of Your Programs
    • Exercise 1: Creating a Basic if Statement
    • Exercise 1: Creating a Basic if Statement
    • Comparison Operators
    • Exercise 2: Using Java Comparison Operators
    • Exercise 2: Using Java Comparison Operators
    • Exercise 3: Implementing a Nested if Statement
    • Exercise 3: Implementing a Nested if Statement
    • Exercise 4: Using if and else Statements
    • Exercise 4: Using if and else Statements
    • Using Complex Conditionals
    • Exercise 5: Using Logical Operators to Create Complex Conditionals
    • Exercise 5: Using Logical Operators to Create Complex Conditionals
    • Using Arithmetic Operators in an if Condition
    • Exercise 6: Using the Ternary Operator
    • Exercise 6: Using the Ternary Operator
    • Exercise 7: Comparing Decimal Values
    • Exercise 7: Comparing Decimal Values
    • Comparing Strings
    • Exercise 8: Using switch
    • Exercise 8: Using switch
    • Exercise 9: Allowing Cases to Fall Through
    • Exercise 9: Allowing Cases to Fall Through
    • Using Java 12 Enhanced Switch Statements
    • Exercise 10: Using Java 12 Switch Statements
    • Exercise 10: Using Java 12 Switch Statements
    • Looping and Performing Repetitive Tasks
    • Exercise 11: Using a Classic for Loop
    • Exercise 11: Using a Classic for Loop
    • Exercise 12: Using an Enhanced for Loop
    • Exercise 12: Using an Enhanced for Loop
    • Exercise 13: Using break and continue
    • Exercise 13: Using break and continue
    • Exercise 14: Using a while Loop
    • Exercise 14: Using a while Loop
    • Using the do-while Loop
    • Exercise 15: Testing Command-Line Arguments
    • Exercise 15: Testing Command-Line Arguments
    • Exercise 16: Converting String to Integers and Doubles
    • Exercise 16: Converting String to Integers and Doubles
    • Diving Deeper into Variables – Immutability
    • Activity 1: Taking Input and Comparing Ranges
    • Summary
  • 3. Object-Oriented Programming

    • Overview
    • Working with Objects in Java
    • Checking the Precedence of a Class with instanceof
    • Exercise 1: Creating the WordTool Class
    • Exercise 1: Creating the WordTool Class
    • Activity 1: Adding the Frequency-of-Symbol Calculation to WordTool
    • Inheritance in Java
    • Overriding and Hiding Methods
    • Overloading Methods and Constructors
    • Recursion
    • Annotations
    • Interfaces
    • Inner Classes
    • Documenting with JavaDoc
    • Activity 2: Adding Documentation to WordTool
    • Summary
    • Survey I
  • 4. Collections, Lists, and Java's Built-In APIs

    • Overview
    • Arrays
    • Activity 1: Searching for Multiple Occurrences in an Array
    • Sets
    • Lists
    • Exercise 1: Creating the AnalyzeInput Application
    • Exercise 1: Creating the AnalyzeInput Application
    • Maps
    • Iterating through Collections
    • Exercise 2: Bringing Analytics into the AnalyzeInput Application
    • Exercise 2: Bringing Analytics into the AnalyzeInput Application
    • Sorting Collections
    • Exercise 3: Sort the Results from the AnalyzeInput Application
    • Exercise 3: Sort the Results from the AnalyzeInput Application
    • Properties
    • Activity 2: Iterating through Large Lists
    • Summary
  • 5. Exceptions

    • Overview
    • A Simple Exception Example
    • NullPointerException – Have No Fear
    • Catching Exceptions
    • Exercise 1: Logging Exceptions
    • Exercise 1: Logging Exceptions
    • Throws and Throw
    • Exercise 2: Breaking the Law (and Fixing it)
    • Exercise 2: Breaking the Law (and Fixing it)
    • The finally Block
    • Activity 1: Designing an Exception Class Logging Data
    • Best Practices for Handling Exceptions
    • Where Do Exceptions Come From?
    • Summary
  • 6. Libraries, Packages, and Modules

    • Overview
    • Organizing Code into Packages
    • Exercise 1: Importing Classes
    • Exercise 1: Importing Classes
    • Fully Qualified Class Names
    • Exercise 2: Creating a Package for a Fitness Tracking App
    • Exercise 2: Creating a Package for a Fitness Tracking App
    • Exercise 3: Building a JAR File
    • Exercise 3: Building a JAR File
    • Exercise 4: Building an Executable JAR File
    • Exercise 4: Building an Executable JAR File
    • Build Tools
    • Exercise 5: Creating a Maven Project
    • Exercise 5: Creating a Maven Project
    • Exercise 6: Adding Java Sources to the Maven Project
    • Exercise 6: Adding Java Sources to the Maven Project
    • Exercise 7: Building the Maven Project
    • Exercise 7: Building the Maven Project
    • Exercise 8: Creating an Executable JAR with Maven
    • Exercise 8: Creating an Executable JAR with Maven
    • Exercise 9: Creating a Gradle Project
    • Exercise 9: Creating a Gradle Project
    • Exercise 10: Building an Executable JAR with Gradle
    • Exercise 10: Building an Executable JAR with Gradle
    • Using Third-Party Libraries
    • Exercise 11: Adding a Third-Party Library Dependency
    • Exercise 11: Adding a Third-Party Library Dependency
    • Exercise 12: Using the Apache Commons Lang Library
    • Exercise 12: Using the Apache Commons Lang Library
    • Using Modules
    • Exercise 13: Creating a Project for a Module
    • Exercise 13: Creating a Project for a Module
    • Exercise 14: Creating a Second Module Using the First One
    • Exercise 14: Creating a Second Module Using the First One
    • Activity 1: Tracking Summer High Temperatures
    • Summary
  • 7. Databases and JDBC

    • Overview
    • Relational Databases
    • Relational Database Management Systems
    • Exercise 1: Running the H2 Database
    • Exercise 1: Running the H2 Database
    • Exercise 2: Creating the Customer Table
    • Exercise 2: Creating the Customer Table
    • Exercise 3: Inserting Data
    • Exercise 3: Inserting Data
    • Retrieving Data
    • Exercise 4: Creating the email Table
    • Exercise 4: Creating the email Table
    • Selecting Data from Multiple Tables
    • Exercise 5: Modifying email Data
    • Exercise 5: Modifying email Data
    • Deleting Data
    • Exercise 6: Querying Data with JDBC
    • Exercise 6: Querying Data with JDBC
    • Sanitizing User Input
    • Exercise 7: Using Prepared Statements with Transactions
    • Exercise 7: Using Prepared Statements with Transactions
    • Simplifying JDBC Programming
    • Activity 1: Track Your Progress
    • Summary
  • 8. Sockets, Files, and Streams

    • Overview
    • Listing Files and Directories
    • Exercise 1: Listing the Contents of Subdirectories
    • Exercise 1: Listing the Contents of Subdirectories
    • Creating and Writing to a File
    • Activity 1: Writing the Directory Structure to a File
    • Reading an Existing File
    • Reading a Properties File
    • Exercise 2: Creating a Properties File from the CLI
    • Exercise 2: Creating a Properties File from the CLI
    • What Are Streams?
    • Activity 2: Improving the EchoServer and EchoClient Programs
    • Blocking and Non-Blocking Calls
    • Summary
  • 9. Working with HTTP

    • Overview
    • Exploring HTTP
    • Using HttpUrlConnection
    • Exercise 1: Creating a HEAD Request
    • Exercise 1: Creating a HEAD Request
    • Exercise 2: Creating a GET Request
    • Exercise 2: Creating a GET Request
    • Dealing with Slow Connections
    • Exercise 3: Sending JSON Data with POST Requests
    • Exercise 3: Sending JSON Data with POST Requests
    • Parsing HTML Data
    • Exercise 4: Using jsoup to Extract Data from HTML
    • Exercise 4: Using jsoup to Extract Data from HTML
    • Delving into the java.net.http Module
    • Exercise 5: Getting HTML Contents Using the java.net.http Module
    • Exercise 5: Getting HTML Contents Using the java.net.http Module
    • Activity 1: Using the jsoup Library to Download Files from the Web
    • Summary
  • 10. Encryption

    • Overview
    • Exercise 1: Encrypting the String using Advanced Encryption Standard
    • Exercise 1: Encrypting the String using Advanced Encryption Standard
    • Block Ciphers
    • Exercise 2: Encrypting the String Using the RSA Asymmetric
    • Exercise 2: Encrypting the String Using the RSA Asymmetric
    • Exercise 3: Encrypting a File
    • Exercise 3: Encrypting a File
    • Summary
    • Survey II
  • 11. Processes

    • Overview
    • Launching a Process
    • Capturing the Output of a Child Process
    • Storing the Output of a Child Process in a File
    • Activity 1: Making a Parent Process to Launch a Child Process
    • Summary
  • 12. Regular Expressions

    • Overview
    • Decrypting Regular Expressions
    • Exercise 1: Implementing Regular Expressions
    • Exercise 1: Implementing Regular Expressions
    • Activity 1: Regular Expressions to Check if the Entrance is Entered in the Desired Format
    • Regular Expressions in Java
    • Exercise 2: Extracting the Domain Using Pattern
    • Exercise 2: Extracting the Domain Using Pattern
    • Exercise 3: Extracting Links Using Pattern Matching
    • Exercise 3: Extracting Links Using Pattern Matching
    • Summary
  • 13. Functional Programming with Lambda Expressions

    • Overview
    • Functional Programming
    • Exercise 1: Writing Pure Functions
    • Exercise 1: Writing Pure Functions
    • Exercise 2: Creating an Immutable Class
    • Exercise 2: Creating an Immutable Class
    • Activity 1: Modifying Immutable Lists
    • Immutable Collections
    • Exercise 3: Overriding the String Method
    • Exercise 3: Overriding the String Method
    • Lambda Expressions
    • Exercise 4: Listing the Spare Tires
    • Exercise 4: Listing the Spare Tires
    • Summary
  • 14. Recursion

    • Overview
    • Exercise 1: Using Recursion to Overflow the Stack
    • Exercise 1: Using Recursion to Overflow the Stack
    • Exercise 2: Using Recursion to Calculate Factorials
    • Exercise 2: Using Recursion to Calculate Factorials
    • Processing an XML Document
    • Exercise 3: Creating an XML File
    • Exercise 3: Creating an XML File
    • Introducing the DOM XML API
    • Exercise 4: Traversing an XML Document
    • Exercise 4: Traversing an XML Document
    • Activity 1: Calculating the Fibonacci Sequence
    • Summary
  • 15. Processing Data with Streams

    • Overview
    • Creating Streams
    • Intermediate Operations
    • Exercise 1: Using the Stream API
    • Exercise 1: Using the Stream API
    • Activity 1: Apply Discount on the Items
    • Using Collectors
    • Exercise 2: Converting CSV to a List
    • Exercise 2: Converting CSV to a List
    • Activity 2: Searching for Specifics
    • Summary
  • 16. Predicates and Other Functional Interfaces

    • Overview
    • Exercise 1: Defining a Predicate
    • Exercise 1: Defining a Predicate
    • Activity 1: Toggling the Sensor States
    • Exercise 2: Producing Side Effects
    • Exercise 2: Producing Side Effects
    • Function
    • Exercise 3: Extracting Data
    • Exercise 3: Extracting Data
    • Activity 2: Using a Recursive Function
    • Activity 3: Using a Lambda Function
    • Summary
    • Survey III
  • 17. Reactive Programming with Java Flow

    • Overview
    • Publisher
    • Subscriber
    • Exercise 1: A Simple Application with a Single Publisher and a Single Subscriber
    • Exercise 1: A Simple Application with a Single Publisher and a Single Subscriber
    • Exercise 2: Using a Processor to Convert a Stream of Strings to Numbers
    • Exercise 2: Using a Processor to Convert a Stream of Strings to Numbers
    • Activity 1: Let NumberProcessor Format Values as Integers
    • Summary
  • 18. Unit Testing

    • Overview
    • Getting Started with Unit Tests
    • Exercise 1: Writing a First Unit Test
    • Exercise 1: Writing a First Unit Test
    • Exercise 2: Writing a Successful Test
    • Exercise 2: Writing a Successful Test
    • Deciding What to Test
    • Exercise 3: Writing a Parameterized Test
    • Exercise 3: Writing a Parameterized Test
    • When Tests Won't Work – Disabling Tests
    • Exercise 4: Using Test Setup and Cleanup Methods
    • Exercise 4: Using Test Setup and Cleanup Methods
    • Mocking
    • Exercise 5: Using Mocks when Testing
    • Exercise 5: Using Mocks when Testing
    • Activity: Counting the Words in the String
    • Summary
  • Activity Solutions

    • Chapter 1 - Activity 1: Obtaining the Minimum of Two Numbers
    • Chapter 1 - Activity 1: Obtaining the Minimum of Two Numbers
    • Chapter 2 - Activity 1: Taking Input and Comparing Ranges
    • Chapter 2 - Activity 1: Taking Input and Comparing Ranges
    • Chapter 3 - Activity 1: Adding the Frequency-of-Symbol Calculation to WordTool
    • Chapter 3 - Activity 2: Adding Documentation to WordTool
    • Chapter 3 - Activity 2: Adding Documentation to WordTool
    • Chapter 4 - Activity 1: Searching for Multiple Occurrences in an Array
    • Chapter 4 - Activity 1: Searching for Multiple Occurrences in an Array
    • Chapter 4 - Activity 2: Iterating through Large Lists
    • Chapter 4 - Activity 2: Iterating through Large Lists
    • Chapter 5 - Activity 1: Designing an Exception Class Logging Data
    • Chapter 5 - Activity 1: Designing an Exception Class Logging Data
    • Chapter 6: Activity 1: Tracking Summer High Temperatures
    • Chapter 6: Activity 1: Tracking Summer High Temperatures
    • Chapter 7 - Activity 1: Track Your Progress
    • Chapter 7 - Activity 1: Track Your Progress
    • Chapter 8 - Activity 1: Writing the Directory Structure to a File
    • Chapter 8 - Activity 1: Writing the Directory Structure to a File
    • Chapter 8 - Activity 2: Improving the EchoServer and EchoClient Programs
    • Chapter 8 - Activity 2: Improving the EchoServer and EchoClient Programs
    • Chapter 9 - Activity 1: Using the jsoup Library to Download Files from the Web
    • Chapter 9 - Activity 1: Using the jsoup Library to Download Files from the Web
    • Chapter 11 - Activity 1: Making a Parent Process to Launch a Child Process
    • Chapter 11 - Activity 1: Making a Parent Process to Launch a Child Process
    • Chapter 12 - Activity 1: Regular Expressions to Check if the Entrance is Entered in the Desired Format
    • Chapter 12 - Activity 1: Regular Expressions to Check if the Entrance is Entered in the Desired Format
    • Chapter 13 - Activity 1: Modifying Immutable Lists
    • Chapter 13 - Activity 1: Modifying Immutable Lists
    • Chapter 14 - Activity 1: Calculating the Fibonacci Sequence
    • Chapter 14 - Activity 1: Calculating the Fibonacci Sequence
    • Chapter 15 - Activity 1: Apply Discount on the Items
    • Chapter 15 - Activity 1: Apply Discount on the Items
    • Chapter 15 - Activity 2: Searching for Specifics
    • Chapter 15 - Activity 2: Searching for Specifics
    • Chapter 16 - Activity 1: Toggling the Sensor States
    • Chapter 16 - Activity 1: Toggling the Sensor States
    • Chapter 16 - Activity 2: Using a Recursive Function
    • Chapter 16 - Activity 2: Using a Recursive Function
    • Chapter 16 - Activity 3: Using a Lambda Function
    • Chapter 16 - Activity 3: Using a Lambda Function
    • Chapter 17 - Activity 1: Let NumberProcessor Format Values as Integers
    • Chapter 17 - Activity 1: Let NumberProcessor Format Values as Integers
    • Chapter 18 - Activity 1: Counting the Words in the String
    • Chapter 18 - Activity 1: Counting the Words in the String

Get Verified

Complete The Java Workshop to unlock your certificate.

You can unlock the certificate by completing the course. The credentials are easy to share, and are ideal for displaying on your LinkedIn profile.
A copy of a certificate for The Java Workshop

Take A Step Forward

There has never been a better time to start learning Java.

  • $24.99

    $24.99The Java Workshop

    Unlock one year of full, unlimited access and get started right away!
    Learn for Free

Already Know Java?

Don't worry, we've got your back with other languages and frameworks too!

Show me my options!