PAST AND PENDING LECTURES AND LABS
Lecture 01. 05 March (Monday). Java types and expressions and the assignment statement. We discuss Java types, expressions, variable declarations, and assignment statements. We demo everything using DrJava. Lecture handout: pdf ppt
Lab 01. Java expressions. This lab involves practice with Java expressions and assignments using the DrJava Interactions pane. pdf html
Lecture 02. 07 March (Friday). We define what an object (manilla folder) is and demo the creation and manipulation of objects in DrJava.We introduce the class definition, which describes the format of all objects of a class. We illustrate using a "subclass" of JFrame customized to our needs. We show how to create a class "specification" using the javadoc facility. pdf ppt SQJFrame.java
Lecture 03. 12 March (Monday). Fields of an object; getters, setters, constructors
We discuss fields and getter and setter methods
for them. We introduce constructors, whose purpose is to initialize
(some) fields of a newly created object. And we show how to test programs using a JUnit testing class. pdf keynote Worker.java WorkerTester.java
Lab 02. Objects and classes. You will practice creating and manipulating JFrame objects using DrJava's interactions pane. Then, you will write your first class definition —a subclass of JFrame, and experiment with it. pdf html
Lecture 04. 14 March (Friday). Testing; the class hierarchy;
static variables and methods.
We discuss testing, including with JUnit. We talk about the
class hierarchy and show you the superest class of them all: Object. We
discuss function toString. We introduce static variables and methods. pdf keynote Point.java
Lecture 05. 26 March (Monday). Inside-out, super-this,
and executing method calls.
We illustrate the inside-out
rule for referencing variables and methods, which is used in most programming
languages. We discuss this and super. Then, we look more closely at how a method call is executed.
We show the four steps involved in executing a method call. We introduce local variables. We now have four kinds of variable: parameter, static variable, field, and
local variable. You should know where and how each is declared and what
its scope is. We introduce
conditional statements and return statements. pdf keynote Worker.java
Evaluating the new-expression. If you are having trouble understanding the new-expression, download file 05-12feb06NewExpression.ppt and open it in powerpoint (if you have it) Then play the presentation. It leads you through evaluation of a new-expression and makes several comments on it.
Lab 03. Two topics: testing and static variables. You will practice creating a test class to test and help find bugs in a class that we give you. Also, we give you some things to do to make clear to you when methods can be made static. pdf html ThreeDimPoint.java
Lecture 06. 28 March (Friday). Odds and ends
on classes, wrapper classes, and class Vector.
We make some points about multiple constructors, overriding, and constructors in
subclasses. Then discuss the wrapper classes for the primitive types and class Vector. pdf ppt 12feb10demo.zip
Lecture 07. 02 April (Monday). Drawing and casting about. We work on further issues with classes and subclasses that arise from the distinction between apparent and real classes, and examine the use of casting and instanceof in these contexts. pdf keynote
Lab 04. Abstract classes and methods. We introduce the notions of abstract classes and methods and state why they are useful. The example program you may play with (optional) gives you practice with them. pdf html DemoShapes.java Shape.java Parallelogram.java Rhombus.java Square.java
Lecture 08. 06 April (Friday). Exceptions. An "Exception" is an "untoward" event like division by 0 or a subscript out of range. Java has a nice facility for handling and recovering from Exceptions. pdf keynote Ex.java OurException.java MyException.java Reader.java
Lab 05. Reading (and writing) files. We show you how to read a file that is on your hard drive. Reading a keyboard and writing as file is just as easy. Do this lab whenever you want, and show it to a TA or instructor. pdf html code&data
Lab 06 (Optional). Exception handling. This lab is optional, It asks you to study and write code that uses exceptions, throw clauses, try-statements, etc. It's best if you read the chapter on exception handling first. pdf doc Lab06.java
Lecture 21. 10 November (Thursday). Listening
to GUIs.
We show how to listen to mouse
clicks on buttons, mouse clicks in on components, and keystrokes.
pdf ppt guis.zip Other examples of gui-listeners:
See Chapter 17 of the CD ProgramLive.
Lecture 20. 08 Nov (Tuesday). Placing components in GUIs.