Java Programming: A Crash Course
(Java 7 plus Java 8 Lambdas & Streams)

September 9-13 2013, JHU Dorsey Center, Elkridge MD
Co-Sponsored by Johns Hopkins Engineering for Professionals

This class is now over. Next public version is tentatively set for summer or fall 2015 at the same Johns Hopkins location in Maryland. In the meantime, please contact for information on a customized onsite version at your location. Lower price, more convenient for your developers, and customizable content. Full-day courses can be held at any location worldwide, but for clients in the Baltimore/Washington area, late afternoon, evening, or weekend sessions can also be arranged.

“Wonderful. In 20 years, this is the best organized, most pragmatic and enjoyable course I've taken.”

“The best instructor-led course I have attended, by far.”

“Best short course ever!”

“Compared to the other short courses I have taken, this one completely redefined my scale from 1-10.”

“In my 35+ years of taking technical courses, Marty's classes consistently come out ranking #1 on my list. Highly relevant material is delivered with enthusiasm, humor, and a high degree of class interaction that is unmatched anywhere.”

more student reviews

This page describes the public (open enrollment) training course on Java programming to be held through at in Elkridge, MD (co-sponsored by the Johns Hopkins University Engineering for Professionals program). The entire course is personally developed and taught by leading Java developer, speaker, and author Marty Hall. No contract instructor regurgitating someone else's materials! Marty has taught Java technology courses onsite for dozens of organizations in the US, Canada, Mexico, Australia, Japan, Norway, Puerto Rico, India, Cambodia, and the Philippines, all to rave reviews.

If you are looking for customized training courses on Java 7 or 8, JSF 2, PrimeFaces, Android, Ajax, jQuery, Hadoop (and Hadoop cerfication), GWT, Spring, Hibernate, Servlets, JSP, HTML5, or RESTful Web Services taught on-site at your company, please see this page.

Register Early! Five of Marty's previous public short courses were full, so reserve your spot today. Registrations are taken in the order they are received.

Course Overview

Java is the world's most popular and widely-applied programming language, but it is large, complex, and sometimes difficult to get started with. This course gives a practical, hands-on introduction to programming with Java 7 and Java 8, the latest versions of the language. The course provides thorough coverage of the the foundational Java topics: basic syntax, object-oriented programming, and core data structures; it also gives a fast-moving survey of some of the most important libraries: graphical user interfaces, multithreaded applications, network programming, serialization, and database access. It also gives an introduction to lambdas and streams in Java 8, the most important features in the upcoming new release of Java. In each section, it gives details on the most important topics, surveys more advanced or lesser-used topics, stresses best practices, and gives plenty of working examples. Each section is followed by a series of hands-on exercises that use Java and Eclipse to reinforce the concepts. There are a choice of exercises of varying complexity so as to accommodate developers with various levels of expertise and previous experience.

Marty normally runs on-site training courses at customer locations. This is easier administratively, is better for clients since the topics and schedule can be customized, and is more cost effective for students since no travel is required. However, due to demand from those who do not have enough students for an on-site course, Marty will be running a public (open enrollment) Java training course at the Johns Hopkins Dorsey Center in Elkridge MD.

The course is developed and taught by Marty Hall, an experienced developer, award-winning instructor, popular conference speaker (5 times at JavaOne), and author of several bestselling Java books.

About the Instructor

Marty and Gosling @ Marty's car

Marty & Java inventor James Gosling at Marty's car.

Marty Hall is the author of six popular Java EE books, including Core Servlets and JavaServer Pages, the all-time worldwide bestselling servlet/JSP book, published in Bulgarian, Chinese Simplified Script (Mainland China), Chinese Traditional Script (Taiwan), Czech, Greek, English, French, German, Hebrew, Japanese, Korean, Macedonian, Polish, Portuguese, Russian, and Spanish. Marty is president of, a training and consulting company focusing on server-side Java technology and Rich Internet Apps with Ajax. In addition to long Java development and consulting experience, Marty has an extensive background in teaching and training, having given training courses on J2EE, JSF 2.0, GWT, and Ajax topics in Japan, Canada, Australia, the Philippines, Mexico, Puerto Rico, India, Cambodia, and dozens of US venues. A popular and entertaining speaker, Marty has spoken at conferences and user groups around the world, including Comdex, the Web 2.0 Expo, the Great Indian Developer Summit, and five times at JavaOne. Marty is also adjunct faculty in the Johns Hopkins University part-time graduate program in Computer Science, where he directs the Java and Web-related concentration areas.


The course consists of an approximately equal mixture of lecture and hands-on lab time. The course assumes that all students are experienced programmers in some language: this is not a course for first-time programmers. Experience with C, C++, C#, or Objective-C is particularly helpful.

Please note: if you are already comfortable with Java, and just want to learn the new Java 8 features (lambdas, method references, streams, the java.util.function package, defender methods, etc.), don't take this course: take the one-day Java 8 course instead.


JHU/EP Logo The course will be held at the Johns Hopkins Dorsey Center in Elkridge, Maryland. This is a modern, comfortable venue with separate computers for each student, fast internet connections, and with coffee, snacks, and meals included. Class meets from 8:30 am to 4:30 pm daily. For students who prefer to bring their own laptops, fast wifi is available, and you can email the instructor for information on installing the class software in advance.

For Maryland residents, the location is centrally located 5 minutes from BWI airport and has plenty of free parking. For out-of-town students, there are many hotels within 1 mile.


The five-day course costs $2695 per student and includes an extensive course notebook, a commercial textbook, exercises, and exercise solutions. Free breakfast, snacks, and lunch. Compare this price to courses from Learning Tree, GlobalKnowledge, and Oracle University that cost $3500-$4200 for five-day courses and $2800-$3000 for four-day courses and that do not include textbooks or meals. Besides, those courses almost always use an unknown instructor who did not develop the course materials and often lacks significant real-world development experience.

To register, fill out and send in the course registration form. Space is limited: five previous offerings of courses were full. Bonus: Register at least two weeks in advance and get a $100 gift certificate from

Questions and More Info

  • Guinea pigs? No! Marty's courses are well-tested, having been taught in 8 countries and dozens of US venues. We don't use your developers as guinea pigs for new materials.
  • Regurgitation? No! Marty developed all his own materials. No contract instructor regurgitating memorized PowerPoint slides.
  • Green? No! Marty is an experienced developer, and is the author of 6 popular Java EE texts from Prentice Hall. The course gives best practices and real-world strategies. No newbie instructor dodging tough questions.


Course now includes an introduction to lambdas in Java 8 (with exercises!). However, if you are already comfortable with Java, and just want to learn the new Java 8 features (lambdas, method references, streams, the java.util.function package, defender methods, etc.), don't take this course: take the one-day Java 8 course instead.

Introduction to and Overview of Java

  • Truths / Myths About Java
    • Java is Web-Enabled?
    • Java is Safe?
    • Java is Cross-Platform?
    • Java is Simple?
    • Java is Powerful?
    • Java is Popular?
  • Java Versions and Application Areas
    • Standard edition
    • Enterprise edition
    • Micro edition

Java with Eclipse: Setup and Getting Started

  • Installing Java
  • Installing Eclipse
  • Importing sample projects
  • Executing simple desktop programs
  • Executing applets
  • Eclipse shortcuts

Basic Java Syntax

  • Creating, compiling, and executing simple Java programs
  • Accessing arrays
  • Looping
  • Indenting code
  • Using if statements
  • Comparing strings
  • Building arrays
  • Performing basic mathematical operations
  • Reading command-line input

Basic Object-Oriented Programming in Java

  • Similarities and differences between Java and C++
  • Object-oriented nomenclature and conventions
  • Instance variables (data members, fields)
  • Methods (member functions)
  • Constructors
  • Example with four variations

Object-Oriented Programming in Java: More Capabilities

  • Overloading
  • Best practices for "real" classes
    • Encapsulation and accessor methods
    • JavaDoc
  • Inheritance
  • Quick intro to advanced topics
    • Abstract classes
    • Interfaces
    • @Override
    • The classpath
    • Packages
    • Visibility modifiers (public, private, protected, [default])
    • JavaDoc options

Applets and Basic Graphics

  • Applet restrictions
  • Basic applet and HTML template
  • The value of @Override
  • The applet life-cycle and the idea of life-cycle methods in general
  • Customizing applets through HTML parameters
  • Methods available for drawing operations
  • Loading and drawing images
  • Using try/catch blocks
  • Controlling image loading

Basic File IO with the NIO Package

  • More on try/catch blocks
    • finally blocks
    • multicatch
    • try with resources
  • Path
  • Simple file reading: all lines at once into List
  • Simple file writing: all at once from a List
  • Some simple file reading and writing utilities
  • Faster and more flexible file reading
  • Faster and more flexible file writing

More Java Syntax and Utilities

  • Data structures
    • ArrayList
    • LinkedList
    • HashMap
  • Using classes and methods that support generic types
  • Defining your own classes and methods that support generic types
  • printf
  • varargs
  • String vs. StringBuilder

Asynchronous Event Handling

  • General event-handling strategy
  • Event-handling options (same four options will be used later with GUI controls and threads)
    • Handling events with separate listeners
    • Handling events by implementing interfaces
    • Handling events with named inner classes
    • Handling events with anonymous inner classes
    • Preview: handling events with Java 8 lambdas
  • The standard AWT listener types
  • Subtleties with mouse events

AWT Components

  • GUI libraries in Java: AWT, Swing, SWT, Java FX
  • Basic AWT windows
    • Canvas, Panel, Frame
  • Closing frames
  • Processing events in GUI controls
  • Basic AWT user interface controls
    • Button, checkbox, radio button, list box

Organizing Windows with Layout Managers

  • How layout managers simplify interface design
  • Standard layout managers
    • FlowLayout, BorderLayout, CardLayout, GridLayout, GridBagLayout
  • Positioning components manually
  • Strategies for using layout managers effectively
  • Drag-and-drop GUI builders for Java

Drawing with Java 2D

  • Overview
  • Drawing Shapes
  • Paint Styles
  • Transparency
  • Using Local Fonts
  • Stroke Styles
  • Coordinate Transformations
  • Requesting Drawing Accuracy

GUIs: Basic Swing

  • New features vs. AWT
  • Basic approach
  • Starting points: JApplet, JFrame
  • Swing equivalent of AWT components (and the new features the Swing components introduce)
  • Swing components that have no AWT equivalent
  • Other simple Swing components

GUIs: Advanced Swing and MVC

  • Building a simple static JList
  • Adding and removing entries from a JList at runtime
  • Making a custom data model: telling JList how to extract data from existing objects and using toString to display a String but return a complex object upon selection
  • Making a custom cell renderer: telling JList what GUI component to use for each of the data cells

Multithreaded Programming

  • Why threads?
  • Basic approach
    • Make a task list with Executors.newFixedThreadPool
    • Add tasks to the list with tasks.execute(someRunnable)
  • Three variations on the theme
    • Separate classes that implement Runnable
    • Main app implements Runnable
    • Inner classes that implement Runnable
  • Related topics
    • Race conditions and synchronization
    • Helpful Thread-related methods
    • Brief summary of advanced issues in concurrency

Network Programming: Clients

  • Creating sockets
  • Implementing a generic network client
  • Parsing data: StringTokenizer (simple but weak) and String.split with regular expressions (more complex but much more powerful)
  • Getting user info from a mail server
  • Retrieving files from an HTTP server
  • Retrieving Web documents by using the URL class

Network Programming: Servers

  • Steps for creating a server
    1. Create a ServerSocket object
    2. Create a Socket object from ServerSocket
    3. Create an input stream
    4. Create an output stream
    5. Do I/O with input and output streams
    6. Close the socket
  • A generic network server
    • Single threaded
    • Multithreaded
  • Accepting connections from browsers
  • A Simple HTTP server

Network Programming: Using Serialization to Send High-Level Data Structures

  • Idea
  • Requirements
  • Steps for sending data
  • Steps for receiving data
  • Example: saving GUI in file
  • Example: sending GUI across network

Java 8: Installation, Setup, and Review of Foundational Topics

  • Installing Java 8
  • Installing an IDE that supports Java 8
  • References
  • Review of basic handlers and anonymous classes: separate classes, main class that implements the interface, named inner classes, anonymous inner classes
  • Review of making generic classes and methods

Java 8 Lambda Expressions Part 1

  • Lambdas: intro, motivation, and big idea
  • Lambda expression interpretation
  • Most basic form of lambdas
  • Type inferencing
  • Expression for body
  • Comparing Java and JavaScript sorting
  • Omitting parens
  • Using effectively final variables
  • @FunctionalInterface
  • Method references
  • java.util.function package

Java 8 Lambda Expressions Part 2

  • Lambda building blocks in java.util.function: overview
  • Predicate
  • Function and BiFunction
  • Consumer
  • Supplier
  • BinaryOperator

Java 8 Lambda Expressions Part 3

  • Variable scoping: Local variables, instance variables, "this"
  • Method references: details -- Class::staticMethod, variable::instanceMethod Class::instanceMethod, Class::new
  • New features in Java 8 interfaces: Default methods (also called "virtual extension methods" or "defender methods") and static methods
  • Methods that return lambdas: From Predicate: and, or, negate, isEqual; From Function: andThen, compose, identity; From Consumer: chain; Custom methods

Java 8 Streams Part 1

  • Overview of Streams
  • Building Streams
  • Outputting Streams into arrays or Lists
  • Core Stream methods: overview, forEach, map, filter, findFirst
  • Lazy evaluation and short-circuit operations

Java 8 Streams Part 2

  • The remaining Stream methods (especially reduce) not covered earlier
  • Parallel Streams
  • Infinite Streams (really unbounded streams with values that are calculated on the fly)