Introduction to Java
5 Days – Course No. W102
who should attend?
Programmers who
will be using Java for the first time, or who want to use Java in conjunction
with the creation of a web page or web site. Students should be familiar with
the Internet, with the World Wide Web, and are assumed to be proficient in at
least one programming language. Knowledge of C and object- oriented programming
is helpful, but is not required. Note:
Students who are proficient in C++ should consider course W103
"Introduction to Java for C++ Programmers".
Prerequisites:
Knowledge and
experience with at least one programming language.
performance objectives
The Java
programming environment is revolutionizing the creation and distribution of
software. This hands-on course introduces the Java language to experienced
programmers in a practical, tangible way. Exercises are used to illustrate key
points. Students will create Java applets that can be taken away from the
course and used as models for future work.
course outline
Introduction
◦ Course logistics
◦ Course objectives
◦ Major topics
Introduction to Java
◦ What is Java?
◦ The Java language
◦ The Java Virtual Machine
◦ Java Programs
◦ The evolution of Java
◦ Java Products
◦ Where do we go from here?
Java Basics
◦ A first application
◦ Compiling Java applications
◦ Running Java applications
◦ Common problems
◦ The structure of Java programs
◦ Data storage
◦ Variables
◦ Variable names
◦ Reserved words
◦ Data types
◦ Declarations and initialization
◦ Assignments, conversions, and casts
Operators and Expressions
◦ The elements of a program
◦ Introduction to operators
◦ Arithmetic operators
◦ Precedence
◦ Relational operators
◦ Logical operators
◦ Increment and decrement operators
◦ Side effects
◦ The conditional operator
◦ Summary of expressions
◦ The Java operator table
Flow of Control
◦ Statements in a Java program
◦ Blocks and compound statements
◦ The if statement
◦ The switch statement
◦ The while loop
◦ The do-while loop
◦ The for loop
Functions and Methods
◦ Introduction to methods
◦ Invoking methods
◦ Return type and value
What is object-orientation?
◦ What is object-orientation?
◦ What is an object?
◦ The language of object-orientation
◦ The objectives of object-orientation
◦ How to get started with object-oriented programming
Objects and Classes I
◦ Preface
◦ Defining classes
◦ Public and private members
◦ Methods
◦ Defining methods
◦ Using objects
◦ The big picture (first view)
◦ Manipulating private data elements
◦ Returning from methods
Objects and Classes II
◦ Static members
◦ Declaring and initializing static data members
◦ Static methods
◦ The main method
◦ Objects versus references
◦ Another class example
◦ Assigning references
◦ Comparing references
◦ Initialization
◦ Constructors
◦ Overloading constructors
◦ Overloaded methods and the method signature
◦ When are constructors invoked?
◦ Destructors, finalizers, and garbage collection
◦ Special object references: this
◦ Special object references: null
◦ Summary
Inheritance
◦ Base and derived classes
◦ Subclasses and superclasses
◦ Overriding method names in derived classes
◦ Special object references: super
◦ Constructors and inheritance
◦ Class hierarchies
◦ Overriding and class hierarchies
◦ Objects, references, and polymorphism
◦ operator
◦ The instanceof operator
◦ "IS A" versus "HAS A"
◦ Public, private and protected elements
◦ Protected members
◦ Final classes, methods and data
◦ Abstract classes and methods
◦ Interfaces
◦ Using interfaces
Creating Java Applets
◦ The basics of applets
◦ Applets and other software
◦ A first applet
◦ Building an applet
◦ HTML and the <applet> tag
◦ Putting it all together
◦ Viewing (running) applets
◦ More on the <applet> tag
◦ The Applet life cycle
◦ The paint() and repaint() methods
◦ I/O from within an applet
◦ Comment on coordinate space
◦ Interfaces and Applets
◦ Applet restrictions
Introduction to Events
◦ The basics of events
◦ The Java event model
◦ Using the Java event model
◦ Java mouse events
Arrays and Vectors
◦ Introduction to arrays in Java
◦ Arrays of objects
◦ Vectors
◦ Adding elements to a Vector
◦ Removing elements from a Vector
◦ Manipulating Vector elements
◦ Other Vector methods
Packages
◦ What are packages?
◦ The import statement
◦ Java packages
◦ Creating and using packages
Creating a Java GUI, Part I
◦ The Java Foundation Classes
◦ GUI components
◦ AWT components
◦ JFC components
◦ AWT labels
◦ Using AWT components
◦ Using Swing components
◦ Swing labels
◦ AWT buttons: Button
◦ Swing buttons: JButton
◦ AWT check boxes: Checkbox
◦ Swing check boxes: JCheckBox
◦ AWT radio buttons: CheckboxGroup
◦ Swing radio buttons: JRadioButton and ButtonGroup
◦ AWT choices: Choice
◦ Swing choices: JComboBox
◦ AWT lists: List
◦ Swing lists: JList
◦ AWT text fields: TextField
◦ AWT text areas: TextArea
◦ Swing text fields: JTextField
◦ Swing text areas: JTextArea
◦ Events in AWT and Swing
◦ Responding to events
◦ Responding to button events
◦ Responding to check box events
◦ Responding to choice events
◦ Responding to list events
◦ Responding to text events
Graphics
◦ Graphics objects
◦ The Graphics coordinate system
◦ Drawing lines and shapes
◦ Drawing lines
◦ Drawing rectangles
◦ Drawing ovals and circles
◦ Drawing polygons
◦ Setting colors
◦ Displaying text
◦ Fonts
◦ FontMetrics
Introduction to Exceptions
◦ When exceptions arise
◦ What is an exception?
◦ Handling exceptions
Creating a Java GUI, Part II
◦ Graphical user interfaces
◦ Grid layout
◦ Flow layout
◦ Border layout
◦ Panels
Introduction to Java Stream I/O
◦ The java.io Package
◦ Stream I/O
◦ Stream Data Encoding
◦ Character Encoding
◦ I/O Exceptions
◦ Node InputStreams and Node Readers
◦ Other node classes
◦ Node OutputStreams and Node Writers
◦ Filter I/O Classes
◦ Buffered I/O
◦ PrintWriter and PrintStream
◦ Conversion Classes
◦ Binary I/O
◦ Object Serialization
◦ What's next?
◦ Random Access I/O
◦ Constructors
◦ Other read and write methods
◦ File
◦ I/O Features in Other Packages
Threads (Optional)
◦ Threads
◦ Thread states
◦ Creating a Thread with a subclass
◦ Creating a Thread with a runnable object
◦ Using threads
◦ Synchronization
Exercises