Click here for expected future lectures


Below are lecture notes and lab notes:

Lecture 26. 24 Apr (Thursday). Applications and Applets.
A stand-alone Java program —one that can be executed outside of DrJava— is either an "application" or an "applet". An application can be executed from a command line in a "terminal" or "DOS" window, or one can double-click on them to start them. Applets can be executed from a conventional html web page. We show you how to make a Java program into an application and into an applet.    pdf    powerpoint

Lab 13. Implementing rectangular arrays. You learn how a rectangular arrays with r rows and c column can be implemented in a 1-dimensional array. This lab is short. If you finish before the end of the lab, feel free to work on A7.  pdf  rtf  TestRecArray.java    RectArray.java    JLiveRead.java

Lecture 25. 22 Apr (Tuesday). On the importance of object orientation.
We have a special guest lecture, Dr. Michael Caspersen of the University of Aarhus, Denmark. He will motivate the OO approach hrough a concrete example/problem. He will demonstrate how a functions-first approach leads to a software design that is hard to maintain and grow in order to meet new requirements, while the objects first approach may lead to a software design that is easily extendable to meet new requirements.


Lecture 24. 17 Apr (Thursday). Listening to GUIs.
We show how to listen to mouse clicks on buttons, mouse clicks in on components, and keystrokes.
pdf   powerpoint   javaFilesUsedInClass (zip file) and other examples of gui-listeners: See Chapter 17 of the CD ProgramLive.

Lab 12. Timing execution. We show you how to time execution of a method call and ask you to compare times for various searching and sorting methods.  pdf  doc  Sorting.java    TestArrays.java

Lecture 23. 15 Apr (Tuesday). Listening to GUIs.
We introduce the interface as a means for requiring that a class implement certain methods. We show how an interface can be used as a type, and this leads to the ability to write a procedure that will sort an array of elements of any type-class as long as that type-class implements a certain interface. pdf    doc


Lecture 22. 10 Apr (Thursday). Two-dimensional arrays
After We look at two-dimensional arrays as rectangular arrays. We then show how Java implements two-dimensional arrays and explain how one can have ragged arrays —arrays where different rows can have different numbers of columns. pdf   powerpoint

Lab 11. Exception handling. This lab asks you write code that uses exceptions, throw clauses, try-statements, etc. pdf   doc   Lab11.java

Lecture 21. 08 April (Tuesday). Placing components in GUIs.
We look at placing components in GUIs. The important points we want you to remember is how a BorderLayout manager is ued to place components in a JFrame, a FlowLayout manager in a JPanel, and a BoxLayout manager in a Box (and what this all means!).After the lecture, listen to lectures on the CD ProgramLive in chapter 17 --that's the best way to learn the stuff. pdf    powerpoint   zip file containing demos


Lecture 20. 03 April (Thursday). Exceptions.
An "Exception" is an event like division by 0, or a subscript out of range. Java has a nice facility for handling and recovering from Exceptions.   pdf    powerpoint

Lab 10. Exercises with loops. This lab asks you to develop loops from specifications and given invariants, giving you practice with our methdology for developing loops.   pdf   doc

Lecture 19. 01 April (Tuesday). Finding an invariant: important algorithms.
We continue look at how to combine diagrams for pre- and post-conditions of an algorithm into an invariant for a loop and use it to develop some interesting algorithms, including sorting algorithms    pdf    powerpoint    Sorting.java  opticalIllusions.pps


Lecture 18. 27 March (Thursday). Developing important algorithms
We look at how to combine diagrams for pre- and post-conditions of an algorithm into an invariant for a loop and use it to develop some interesting algorithms, including the dutch national flag problem and the partition algorithm of quicksort.    pdf    powerpoint    Sorting.java  

Lab 09. Formating in Locales. A "locale" is a country and language. Different countries and languages have different ways of writing numbers, percentages, and currencies. This lab shows how JavJava class Locale makes it easy to use the formats of many countries.    pdf   html   JLiveWindow.java   MyJLiveWindow.java

Lecture 17. 25 March (Tuesday). More on arrays.
We develop a few algorithms that manipulate arrays —copying an array, testing whether two arrays are equal, implementing a table of values in an array, and so on.   pdf    powerpoint


Lecture 16. 13 March (Thursday). Arrays.
We introduce arrays. An array, like Vector, is an object that can contain a list of things. A variable of type int[] contains the name of an object that contains a list of ints. A variable of type JFrame[] contains the name of an object that contans a list of JFrame objects. Type array is built into Java; there is a nice notatioin b[i] for accessing element i of array b.   pdf     powerpoint

Lab 08. Reading files. We show you how to read a file that is on your harddrive. Reading a keyboard and writing as file is just as easy.   pdf    html    Lab08.java    test.txt

Lecture 15. 11 March (Tuesday). The while loop.
We introduce the while loop, relate it to the for-loop, talk about the four loopy questions for understanding a while loop, and develop some while loops.   pdf    powerpoint


Lecture 14. 06 March (Thursday). More on loops.
We continue with the discussion of developing for-loops that process a range of integers, using postconditions and invariants, We end with a short introduction to while loops.   pdf    powerpoint

Lab 07. Loops and assertions. This lab deals with some paper-and-pencil exercises on ranges, assertions, and for-loops. It also asks you to write four functions whose bodies contain for-loops.   pdf    rtf    Lab07.java

Lecture 13. 04 March (Tuesday). Turtles and loops
We discuss briefly how to draw on a panel of a JFrame using a "Turtle" —you will do this in assignment A5. We then begin a discussion of loops, starting with a for-loop to process a range of integers.. pdf   ppt


Lecture 12. 28 February (Thursday). Casting about
You know about casting from int to double and double to int, e.g. (int) 3.4. We now show you how to cast from one class-type to another and discuss why this is useful. And we a talk about a new operator, instanceof. This is the last lecture on classes. pdf   ppt     Work.txt

Lab 06. Recursion. You will write at least 5 recursive functions.   pdf    html   Rec.java

Lecture 11. 26 February (Tuesday). Recursion!
We develop a few more recursive procedure, including Hilbert's space-filling curve. As we figure out how many recursive calls one function makes, we will have to discuss the binary number system. pdf   powerpoint  Silly quips on jobs   Demo.java: recursive methods from class.


Lecture 10. 21 February (Thursday). Recursion!
We introduce recursion: a method calling itself. This provides power and flexiblity that we haven't had yet, and you will (should) be amazed at how simple it will be to do neat things.   pdf   powerpoint    D.java (contains functions we wrote in class)

Lab 05. Class Vector. An instance of class Vector can contain a list of objects, and the list can expand and shrink. In this lab, we study this class. It will be used in a lot of our future work.   pdf    html    Lab05.java

Lecture 09. 19 February (Tuesday). Wrapper classes and stepwise refinement!
Each primitive type has an associated "wrapper class". An object of the wrapper class contains one value of the primitive type. We show you why this is useful. We also spend more time developing an algorithm, showing you "top-down programmng" and "stepwise refinement".   pdf   ppt


Lecture 08. 14 February (Thursday). Odds and ends on classes
We review some material about classes and make some points about overriding, method equals, and constructors in subclasses. We also finish method anglicize from last lecture and talk about stepwise refinement.    pdf    powerpoint   two classes to anglicize:   Ang   AngTester

Lab 04. Writing functions. You will practice writing functions. These have to do with manipulating Strings, a topic that you will have to know for prelim 1. An important point should become clear: a value of String is an object (manilla folder), so a test s1 == s2  where s1 and s2 are Strings tests whether they are the same folder or not. Method sa.equals(s2) should be used to test whether two Strings have the same value.  pdf   html   Methods.java

Lecture 07. 12 February (Tuesday). Inside-out, super-this, and stepwise refinement
We illustrate the inside-out rule for referencing variables and methods that is in most programming languages. We show a problem and introduce this and super to solve it. (Another use of super and this will be shown on Thursday.) Finally, we talk about stepwise refinement as a way to think about the development of methods from their specifications and develop a few methods from their specifications.   pdf   powerpoint


Lecture 06. 07 February (Thursday). Methods
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   powerpoint

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 05. 05 Feburary (Tuesday). The class hierarchy; static variables; more on testing.
We continue our discussion of testing. We talk about the class hierarchy and show you the superest class of them all: Object. We discuss function toString. We introduce static variables.  pdf   powerpoint   Chapter.java   ChapterTester.java


Lecture 04. 31 January (Thursday). Customizing a class (continued) and testing
(1) We discuss fields and getter and setter methods for them. (2) We introduce the constructors, whose purpose is to initialize (some) fields of a newly created object. (3) We show you how to test the methods in a class using a JUnit tester.   pdf   ppt    Chapter.java    ChapterTester.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 03. 29 January (Tuesday). Customizing a class
We introduce the class definition, which describes the format of all manila folders (object, instances) of a class and defines its methods. This is illustrated using a "subclass" of JFrame to customize it to our needs. We also show how to create a "specification" of the class using the javadoc facility. And we talk about null.   pdf   ppt


Lecture 02. 24 January (Thursday).
We define what an object (manilla folder) is and demo the creation and manipulation of objects in DrJava. This material, in Sect. 1.3 of the text, is the basis for the next lecture, so study the material and practice using DrJava. Look at the self-study exercises in the text and do some of them. The more you practice, the easier it will seem.   ppt    pdf

Lab 01. Java expressions. This lab gave you practice with Java expressions and the assignment using the DrJava Interactions pane.   pdf   html

Lecture 01. 22 January (Tuesday). Java expressions, variables, declarations, and assignments
We continue discussing expressions in Java (Secs. 1.1 and 1.2) of the text. We show how to cast between int and double. And we introduce the variable, declaration, and assignment statement. Lab 01 gives you practice with these features of Java. Lecture handout:  ppt   pdf


 

Below is a list of the expected topics of future lectures and labs.

 

Lecture 26. 28 Nov (Thursday). Last Lecture!

Lab 12. Open lab. The TA and the consultants will be at the lab. However, there is no scheduled task for you to do. If you want, come and work on the assignment(s), and take advantage of the situation to get help from the TAs and consultants, if you need the help.

Lecture 25. 27 Apr (Tuesday). Applications and Applets.
A stand-alone Java program —one that can be executed outside of DrJava— is either an "application" or an "applet". An application can be executed from a command line in a "terminal" or "DOS" window, or one can double-click on them to start them. Applets can be executed from a conventional html web page. We show you how to make a Java program into an application and into an applet.    pdf    powerpoint


Lecture .... 22 Nov (Thursday). Happy Thanksgiving!

Lab. No lab, because of Thanksgiving. However, the lab should be open Tuesday afternoon, and you can work on the assignments.

Lecture 24. 20 Nov (Tuesday). Lecture is canceled. Happy Thanksgiving!


Lecture 23. 15 Nov (Thursday). Assignment A8 and testing.
We discuss the last assignment, showing how a character can be hidden in a pixel or two. We demo the solution. Then, we talk about testing and the need to use println statements in judiciously chosen places in order to see what values variables have.

 

Lecture 22. 13 Apr (Tuesday). Listening to GUIs.
After presenting Quicksort, we show how to listen to mouse clicks on buttons, mouse clicks in on components, and keystrokes.
pdf   powerpoint   javaFilesUsedInClass (zip file) and other examples of gui-listeners: See Chapter 17 of the CD ProgramLive.