Introduction to Java for C++ Programmers
Course #W103
3 Days
Benefits
This hands-on course introduces the Java language to C++ programmers in a practical, tangible way. Students will create Java applets that can be taken away from the course and used as models for future work.
Target Student
Application programmers familiar with C++ and the concepts of object- orientation. It is assumed that students will be familiar with the Internet and with basic HTML.
Prerequisites
▪ Introduction to Object-Oriented Programming with C++ or equivalent experience.
▪ Introduction to Publishing on the World Wide Web with HTML (W002) or equivalent experience.
Course Outline
Introduction to Java
▪ The Java language
▪ Java products
▪ Java without a browser?
▪ Applications versus Applets
▪ A first application
From C++ to Java
▪ Introduction
▪ High-level comparison
▪ Comments
▪ Program structure
▪ Basic I/O
▪ Variables
▪ Reserved words
▪ Data types
▪ Integers
▪ Characters
▪ Floating point values
▪ Booleans
▪ Declarations and initialization
▪ Assignments, conversions, and casts
▪ Expressions
▪ Flow of control
▪ Miscellaneous differences
Java Classes
▪ Defining classes
▪ Defining instances
▪ Using objects
▪ Objects versus references
▪ Assigning references
▪ Comparing references
▪ Static members
▪ The main method
▪ Manipulating private data elements
▪ Constructors
▪ Destructors, finalizers, and garbage
▪ collection
▪ Special object references: this
▪ Special object references: null
▪ Base and derived classes
▪ Superclasses and subclasses
▪ Overriding method names in derived
▪ classes
▪ Overriding and class hierarchies
▪ Special object references: super
▪ Constructors and inheritance
▪ Objects, references, and
▪ polymorphism
▪ The instanceof operator
▪ Public, private and protected elements
▪ Protected members
▪ Final classes and methods
▪ Abstract classes and methods
▪ Interfaces
Applications and Applets
▪ What is a Java program?
▪ Applications
▪ Applets
▪ The structure of Java applications
▪ Compiling Java applications
▪ Running Java applications
▪ The basics of applets
▪ Applets and other software
▪ A first applet
▪ HTML and the <applet> tag
▪ Putting it all together
▪ Viewing (running) applets
▪ More on the <applet> tag
▪ Building an applet
▪ Where's main?
▪ More on starting and stopping
▪ The paint() and repaint() methods
▪ I/O from within an applet
▪ Comment on coordinate space
▪ Interfaces and Applets
Introduction to Events
▪ The basics of events
▪ Handling events: Java 1.0 and Java
▪ 1.1
▪ Java 1.0: the inheritance event model
▪ Java 1.0 mouse events
▪ Overriding methods in the inheritance model
▪ Problems with the inheritance model
▪ Java 1.1: the delegation event model
▪ Comparing inheritance and delegation
▪ Java 1.1 mouse events
Arrays and Vectors
▪ Arrays in Java vs. arrays in C
▪ Arrays in Java
▪ Arrays of objects
▪ Copying arrays
▪ Vectors
▪ Adding elements to a Vector
▪ Removing elements from a Vector
▪ Manipulating Vector elements
AWT, Part I
▪ Graphical user interface components
▪ Labels
▪ Buttons
▪ Checkboxes
▪ Checkbox groups
▪ Choices
▪ Lists
▪ Text fields
▪ Text areas
▪ AWT events
▪ The action method in Java 1.0
▪ The 1.0 Event object
▪ Button events in Java 1.0
▪ Checkbox events in Java 1.0
▪ Choice events in Java 1.0
▪ List events in Java 1.0
▪ Text events in Java 1.0
▪ AWT events in Java 1.1
▪ Responding to events in Java 1.1
▪ Button events in Java 1.1
▪ Checkbox events in Java 1.1
▪ Choice events in Java 1.1
▪ List events in Java 1.1
▪ Text events in Java 1.1
Graphics
▪ Graphics objects
▪ The Graphics coordinate system
▪ Drawing lines and shapes
▪ Drawing lines
▪ Drawing rectangles
▪ Drawing ovals and circles
▪ Drawing polygons
▪ Setting colours
▪ Displaying text
▪ Fonts
▪ FontMetrics
▪ Images
▪ Acquiring images
▪ Displaying images
Packages
▪ What are packages?
▪ The import statement
▪ Java packages
▪ Creating and using packages
Introduction to Exceptions
▪ When exceptions arise
▪ What is an exception?
▪ Handling exceptions
▪ Declaring exceptions
AWT, Part II
▪ Graphical user interfaces
▪ Grid layout
▪ Flow layout
▪ Border layout
▪ Card layout
▪ Panels
▪ Canvases
▪ Containment hierarchies
Threads and Multimedia
▪ Threads
▪ Thread states
▪ Newborn
▪ Dead
▪ Runnable
▪ Running
▪ Blocked
▪ Synchronized methods
▪ Using threads
▪ Introduction to Multimedia
▪ Using audio in an applet
▪ Using the AudioClip interface
▪ Animation
▪ The update method
Introduction to Java Security
▪ Java programs and security
▪ Security and executable content
▪ Solving the security problem
▪ Security and Java language features
▪ Applet restrictions
▪ The SecurityManager class
▪ Denial of service
Introduction to Java I/O
▪ The Java I/O model
▪ File I/O
▪ The File class
▪ Stream I/O in the System class
▪ Output streams
▪ Input streams
▪ Random access files