103. Java
Programming
Rev. 1.4.3
This course is now available directly from our partner, Capstone Courseware.
This course teaches programming in the Java language – the Java 2
Standard or J2SE platform. It is
intended for programmers with experience in languages other than Java, but who
may or may not have any previous Java experience. It focuses on procedural-coding skills first,
and then offers meticulous, in-depth coverage of object-oriented concepts and
how to apply them to Java software design and development. The latter part of the course moves from
these basic skills into key parts of the J2SE Core API, including collections, exception
handling, and object serialization. The
course software also includes an optional overlay of workspace and project
files to support use of the Eclipse IDE in the classroom. (This requires that the instructor be
experienced in use of Eclipse and able to walk students through basic tasks in
the IDE.)
This revision of the course begins Object Innovations’ migration
from Java 1.4 to Java 5.0: it continues
to focus on the 1.4.2 SDK and language, but highlights missing features and
areas that are improved in the 5.0 JDK and language. It includes two code examples which will of
course not build in the 1.4.2 environment, but work in 5.0 and offer examples
of emerging Java-5.0 coding practices.
(For training entirely within the Java 5.0 environment, see version 5.0
of this course; to read more about different versions of Java and for help
deciding on which version of this course to use, see “Java Versions
and Terminology Demystified”.)
Students come to Java from a wide range of backgrounds, and this
course is designed to be as flexible as possible over the upper end of that
range. Specifically:
·
Experienced C and C++ programmers will find this
course a very good fit and if anything will find that they complete it in a
little less than the full five-day timeline.
·
Those with experience in languages less like Java,
such as Visual Basic, ASP and other Web-scripting languages, and other
pseudo-object-oriented languages may need more time in the early going, and
this course covers its introductory topics in good depth and offers many
optional and “challenge” labs to support this.
·
Less experienced programmers or those coming
from non-structured languages – such as COBOL, PL/1, or 4GL tools – will
probably not cover the whole course in a week, and may want to pursue an
abbreviated version at a slower pace.
This too is quite feasible.
LEARNING OBJECTIVES
·
Chiefly, learn to program effectively in the
Java language.
·
Understand the Java software architecture, and
the design decisions which make Java software portable, efficient, secure and
robust.
·
Learn how to configure a simple Java development
environment.
·
Know the grammar, data types and flow control
constructs of the Java language for simple procedural programming.
·
Understand Java as a purely object-oriented
language, and implement software as systems of classes.
·
Implement and use inheritance and polymorphism,
including interfaces and abstract classes.
·
Design appropriate exception handling into Java
methods.
·
Understand the structure of streams in Java, and
learn how to use streams to manage file I/O.
·
Learn how to use Java Serialization to
internalize and externalize potentially complex graphs of objects.
Course Duration: 5 days
Prerequisites: No prior Java experience is required, but
students must be experienced programmers in another third-generation (high-level)
language. See the overview for
suggestions about pace and scope for different backgrounds.
1. The Java
Environment
Overview of Architecture
Forms for Java Software
Three Platforms
Java Virtual Machine
The Core API
Java Runtime Environment
Java SDK
Java Class Path
Portability and Efficiency
2. Language
Fundamentals
Source File Format
Application Classes
Code Grammar and Expressions
Identifiers
Literals
Operators
Expressions
Calling Methods
3. Data Types
Primitive Types
Type Conversion
Numeric Types
Characters and Booleans
Java 1.5: Enumerations
Object References
Comparing and Assigning References
Strings
Arrays
4. Flow Control
The main Method
Calling and Returning from Methods
Conditional Constructs
Looping Constructs
Java 1.5: the For-Each Loop
Processing Arrays
Recursion
5.
Object-Oriented Software
Complex Systems
Abstraction
Classes and Objects
Responsibilities and Collaborators
UML
Relationships
Visibility
6. Classes and
Objects
Java Classes
Constructors and Garbage Collection
Naming Conventions and JavaBeans
Packages and Imports
Relationships Between Classes
Using this
Visibility
Overloading Methods
JARs
7. Inheritance
and Polymorphism in Java
Extending Classes
Using Derived Classes
Type Identification
Compile-Time and Run-Time Type
Polymorphism
Overriding Methods
Superclass Reference
8. Using Classes
Effectively
Class Loading
Static Members
Statics and Non-Statics
Static Initializers
Prohibiting Inheritance
Costs of Object Creation
Strings and StringBuffers
Controlling Object Creation
9. Interfaces and
Abstract Classes
Separating Interface and Implementation
UML Interfaces and Realization
Defining Interfaces
Implementing and Extending Interfaces
Abstract Classes
10. Collections
Dynamic Collections
Collections vs. Arrays
The Collections API
Abstraction: The Collection Interface
Vector, LinkedList, ArrayList
Reading Elements and Downcasting
Collecting Primitive Values
Algorithmic Programming
Iterators
Maps
Sorted Collections
Java 1.5: Generics
Java 1.5: Auto-Boxing
Java 1.5: Type-Safe Collections
Java 1.5: Variable Argument Lists
Java 1.5: Formatted Output
11. Exception
Handling
Reporting and Trapping Errors
Exception Handling
Throwing Exceptions
Declaring Exceptions per Method
Catching Exceptions
The finally Block
Catch-and-Release
Chaining Exceptions
12. Inner Classes
Passing Behavior
Named Inner Classes
Outer Object Reference
Static Inner Classes
Anonymous Inner Classes
13. The Java
Streams Model
Delegation-Based Stream Model
InputStream and OutputStream
Media-Based Streams
Filtering Streams
Readers and Writers
14. Working with
Files
File Class
Modeling Files and Directories
File Streams
Random-Access Files
15. Advanced
Stream Techniques
Buffering
Data Streams
Push-Back Parsing
Byte-Array Streams and String Readers and Writers
16. Java Serialization
The Challenge of Object Serialization
Serialization API
Serializable Interface
ObjectInputStream and ObjectOutputStream
The Serialization Engine
Transient Fields
readObject and writeObject
Externalizable Interface
Appendix A. Learning Resources
System Requirements
Hardware – minimal: Pentium 500MHz, 128 meg RAM, 500 meg HD.
Hardware – recommended: Pentium 1.5gHz, 512 meg RAM, 1
gig HD.
Operating system: Tested on Windows XP Professional. The course software should be viable on all
Windows or Linux systems which support J2SE 1.4.
Software: All free downloadable tools.