Java Programming for C++ Developers

This course helps C++ developers get up to speed quickly with the Java programming language and the Java Standard Edition (SE) 7 development platform. The course focuses on the differences between the C++ and Java languages, and also explains how the C++ STL library maps to the Java SDK.

Duration

4 days

 

Prerequisites

  • At least 6 months programming experience, ideally in C++

What you'll learn

  • Understanding core differences between Java and C++
  • Defining and using classes
  • Using arrays, collections, and generics
  • Implementing inheritance and polymorphism
  • Working with exceptions
  • Multithreading
  • Using common Java APIs and techniques

Course details

Getting Started with Java

  • Compiling and running Java applications
  • The role of the JVM
  • JAR files
  • Understanding Ant and Maven
  • Where to get more information about Java in online communities
  • Common open-source libraries

Core Language Differences between C++ and Java

  • Everything is a class
  • Primitive types vs. reference types
  • Packages

Miscellaneous Language Bits n Pieces

  • Differences in variable declarations and operators
  • Loops and decision-making differences
  • Useful Java classes
  • Strings
  • Wrapper classes

Defining and Using Classes

  • Classes in Java
  • Differences in how to declare data members and member functions
  • Differences in initialization and construction
  • Parameter passing modes in Java

Arrays

  • Declaring and using arrays
  • A world without pointers
  • Traversing arrays
  • Using the Arrays class
  • Multi-dimensional arrays

Inheritance

  • Differences in inheritance between C++ and Java
  • Polymorphism
  • Abstract classes and methods
  • Final classes and methods
  • The Object class
  • The lack of multiple inheritance

Interfaces

  • Overview of interfaces, compared with pure virtual classes in C++
  • Defining and implementing interfaces
  • Using interfaces in client code
  • Multiple inheritance of interfaces

Collections and Generics

  • Overview of collections and generics
  • Using Java collection classes vs. C++ STL classes
  • Defining generic classes and generic methods vs. C++ template classes

Exceptions and Assertions

  • Overview of exception handling
  • Throwing and catching exceptions
  • Standard exception classes
  • Defining new exception classes
  • Working with assertions

Going Further with the Java Language

  • Autoboxing and unboxing
  • Varargs
  • Type-safe enumerations
  • Static imports

Inner Classes

  • Overview of inner classes
  • Regular inner classes
  • Method-local inner classes
  • Anonymous inner classes
  • Static nested classes

Multithreading

  • Creating multiple threads
  • Synchronizing threads
  • Synchronization classes
  • Concurrency API

Additional Multithreading Issues

  • Using concurrent collections
  • Using synchronizers and locks
  • Thread pooling techniques
  • Using the executor framework
  • Using pooling effectively

Common Java APIs

  • Reading and writing files
  • Accessing databases using JDBC
  • Calling Web Service

Reflection

  • Dynamic retrieval of information using reflection vs. RTTI in C++
  • Creating instances of extensibility objects
  • Class fields, methods and constructors

Sockets

  • Introduction to sockets
  • Implementing a socket server
  • Implementing a socket client
  • Overview of NIO

Tuning Garbage Collection

  • Essential concepts
  • Understanding object lifetimes
  • Generational collectors
  • Heap organization
  • Garbage collection options
  • Garbage collection monitoring and tuning