Calendar/Outline for First Course in Java

Sessions

 

 

 

Session Lecture Topics Assignment Due (email by 5 p.m.)
1: Tuesday, June 5

This session covers the reading in Day 1: 21st Century Java

lecture notes

Introduction to class and explanation of the syllabus

Demonstration of the “Hello World” Java application

Demonstration of the Java Glossary applet

What is Programming?

  • Applications (and applets)
  • Syntax and semantics
  • Computer architecture
  • Java compared to C/C++
    • Platform independence
    • Source code compiled to byte code and interpreted by the Java virtual machine (JVM)

Sun’s web site

  • How to download Java
  • How to install Java
  • How to use Sun’s Java tutorial
Download, install, and run the “Hello, World” program

[working code]

Nothing this week
2:
Thursday, June 7

This session covers the reading in Day 3: ABCs of Java, and Day 5: Lists, Logic, and Loops

lecture notes

Review of Session 1 and Short Quiz

Basics of (Java) Programming Language

  • Variables, Constants, and Data Types
    • boolean, char, int, double, float
    • arrays
    • constants are “final”
  • Declarations and Assignments
    • Data type + variable name
    • Equals (=)
  • Operators (arithmetic, logical, and binary)
  • Control and Flow Constructs
    • Conditional expressions (“if”, “else”)
    • Loops (“for”, “while”, “do … while”)
Three assignments:

See this session's lecture notes

[working code]

 
3:
Tuesday, June 12

This session covers the reading in Day 2: A Taste of Object-Oriented Programming

lecture notes

Review of Session 2  and Short Quiz

Object-Oriented Programming (basics)

  • Objects
    • OOP versus Procedural Programming
    • embody a level of abstraction that is closer to everyday reality than are procedures
    • Advantages of object-oriented programming
      • Division of labor
      • Reusability/maintainability
    • Challenges of object-oriented programming
      • Need for up-front design
      • Overhead at compile-time and run-time
  • Classes
    • “Hello World” application uses a class
    • Real-world style objects: customer and book
  • Methods and Attributes
    • Methods: the “behavior” of an object
    • Attributes: the “state” of an object
    • Simple method calls, recursive calls
    • Example of methods for customer and book

Tower of Hanoi design exercise

[see lecture notes]

Status of downloading and configuring your SDK.

Homework 2.

4:
Thursday, June 14

This session covers the readings in  and Day 4: Working with Objects and Day 6: Creating Classes and Methods

lecture notes

Review of Session 3 and Short Quiz

Object-Oriented Programming (continued)

  • Inheritance
  • Polymorphism
    • using an array
    • Vector (self-sizing array)
    • Example: geometric shapes
  • Encapsulation
    • visibility
    • security; division of work
  • Interfaces
    • enhancing single-inheritance
    • specifying a set of methods for later implementation
    • advantages for the workflow of a software development organization
Assignment: Design the library book tracking system, but this time, use polymorphism, encapsulation, and an interface to create objects:
  • Reference Book and Book
  • Graduate Student and Student

[design exercise]

 
5:
Tuesday, June 19

This session covers the reading in Day 15: Packages, Interfaces, and Other Features and Day 16: Error Handling and Security

lecture notes

Review of Session 4 and Short Quiz

Inheritance: When To Use and Not Use It

  • Good: broad and shallow hierarchies, such as geometric shapes
  • Bad: narrow and deep hierarchies, such as Java’s input/output package

Input/Output (io package)

  • Use the API to learn about Input/Output
  • FileStream, Buffered Input Stream for a Buffered Reader
  • Why Input/Output does NOT use inheritance

Exception Handling 

  • built-in best practices/management
  • a case of inheritance
  • throw, throws
  • try, catch, finally

Packaging System: import statement

  • Performance benefits
  • Overview of the key packages
  • io, util, applet, awt
  • how to use the API to learn about the packages
See lecture notes Homework 3 and Homework 4
6:
Thursday, June 21

This session covers the JavaDoc material in Appendix C, pp. 598 - 602

Lecture Notes

Review of Session 5 and Short Quiz

Midterm Exam

Review of the midterm

Overview of JavaDoc as used in Sun’s Java APIs

Commenting Your Code With JavaDoc

  • What is JavaDoc? (HTML pages)
  • How to make comments
  • How to run JavaDoc
  • Examples of helpful and unhelpful comments (“The Elements of Java Style”)
   
7:
Tuesday, June 26

This session covers the reading in Day 7: Writing Java Applets, and Day 12: Color, Fonts, and Graphics

Lecture Notes

Student presentations on Java technologies

individual or team of two presentations of 5-10 minutes each on a topic such as:
--any package in the SDK http://java.sun.com/j2se/1.3/docs/api/index.html

--jsp (Java Server Pages), such as JRun

http://www.allaire.com/Products/JRun/
 
or TomCat http://jakarta.apache.org/tomcat/index.html

--ant (Open Source build tool) at
http://jakarta.apache.org/ant/index.html

Introducing Applets

  • What is an applet?
  • How does an applet run?
  • Basic HTML to embed an applet in a web page
  • Creating an applet
    • extend the applet class
    • Swing applets versus AWT applets
    • Basic methods: paint(), init()
    • Demonstration
  • More advanced features
    • parameters
    • size
Write an applet that draws geometric shapes and also uses color and text

[working code]

Homework 5 and Homework 6
8:
Thursday, June 28

This session covers the reading in Day 8: Working with Swing, and Day 11: Responding to User Input in an Applet

Lecture Notes

Review of Session 7

Applets and Event-driven programming in a Graphical User Interface (GUI)

Short Quiz

Make your existing applet interactive

[working code]

 
9:
Tuesday, July 3

This session covers the reading in Day 9: Building a Swing Interface, and Day 10: Arranging Components on a User Interface

Lecture Notes

Review of Session 8 and introduction to possible questions for the final exam.

Polymorphism and Inheritance in a GUI

  • Lists, dialogs, panels, frames
  • Arranging components in a GUI
    • Simple layouts
    • Advanced layouts, including the "grid bag" layout


 

Homework 7 and Homework 8
10:
Thursday, July 5
Review of Session 9 and Short Quiz

Final Exam

Review of the final

How you can teach yourself more advanced topics using the APIs:

  • Networking (Client/Server)
  • Threads (background printing)
  • Swing (advanced GUI)

 

   

back to course syllabus

[updated 23 June 2001]