Click here for expected future lectures
Calendar (list of lectures, showing also prelims, some assignments)
PAST AND PENDING LECTURES AND LABS
Lecture 26. 01 December (Thursday). Conclusion. Don't miss it!
CS history and other things pdf ppt
Lab 12. Exception handling. This lab is optional, and you do not have to show it to your TA. However, it is best that you do the lab yourself, because exception handling is on the final
This
lab 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 Lab12.java
Lecture 25. 29 Novemberl (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 it. Applets are started when an html
web page contains the proper "applet tag". We show you how to make a Java program into an application and into
an applet, we show you how to create a jar file that contains an application or an applet, and we also look at the language html, which is used to construct web pages. pdf ppt zip file containing demos
24 November (Thursday). Happy Thanksgiving!
Lecture 24. 22 November (Tuesday). Interfaces. An interface is like an abstract class in which all methods are abstract. A class may extend only one other class, but it can "implement" several interfaces. We show how this feature can be used effectively. pdf keynote demo code
Lecture 23. 17 November (Thursday). Ragged arrays. We show how Java treats a two-dimensional array: as one-dimensional array whose elements are one-dimensional arrays. This allows us to have an array whose rows have different lengths, giving you "ragged" arrays. pdf ppt
Lab 11. 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 22. 15 November (Tuesday). 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
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 11nov08guis.zip Other examples of gui-listeners:
See Chapter 17 of the CD ProgramLive.
Lab 10. 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. pdf html code&data
Lecture 20. 08 Nov (Tuesday). Placing components in GUIs.Lecture 19. 03 November (Thursday). Finding an invariant: important algorithms.
We continue our study of developing algorithms that process arrays, including sorting algorithms. We develop the famous recursive sorting algorithm, Quicksort. pdf ppt pres.pdf pres.ppt
Lab 09. Exercises with loops. This lab asks you to develop loops from specifications and given invariants, giving you practice with the methdology for developing loops. pdf doc
Lecture 18. 01 November (Tuesday). Finding
an invariant: important algorithms.
We develop the partition algorithm, Dutch National Flag, and others. We also discuss 2D arrays and some other A6 related topics. Most of the lecture used the slides from Lecture 17. Sorting.java contains all the searching/sorting methods we use in this class. Download it. pdf keynote D.java Sorting.java
Lecture 17. 29 October (Thursday). Array algorithms.
We look at some of the basic algorithms that operate on arrays, as well as how to analyze and develop them by combining
diagrams for pre- and post-conditions of an algorithm into an invariant
for a loop. pdf keynote
File D.java contains the methods we developed and comments about how the invariant works.
Lab 08. Abstract classes and methods. We introduce the notions of abstract classes and methods and state why they are useful. The example program you will play with gives you practice with them. pdf html DemoShapes.java Shape.java Parallelogram.java Rhombus.java Square.java
Lecture 16. 25 October (Tuesday). 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 contains a list of JFrame objects. Type array is built into Java; there is a nice mathematical notation b[i] for accessing element i of array b. We consider right and wrong methods for swapping values of array entries. pdf keynote
File D.java contains the methods we developed in lecture. It also contains the function to roll a die with a apoosible unfair die as well as a procedure that can be used to test it, rolling the die many times and tabulating the results. Take a look!
Lecture 15. 20 October (Thursday). 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 ppt
Lab 07. For-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 doc Lab07.java
Lecture 14. 18 October (Tuesday). More on loops.Lecture 13. 13 October (Thursday). Loops
We introduce assignment A5, drawing graphics with turtles and pens. This assignment gives practice with loops and recursion.
We begin a discussion of loops, starting with a for-loop to process a range of integers. pdf keynote
Here is Tiling Elaine's kitchen, revised to use the acm graphics package: kitchenacm.zip
Lecture 12. 06 October (Thursday). 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 06. Recursion. You will write at least 4 recursive functions. pdf html
Lecture 11. 04 October (Tuesday). More recursion
We
develop a few more recursive procedures, including Hilbert's space-filling curve. We execute some recursive calls. As we figure out how many recursive calls one function makes, we will have to discuss the binary number system. pdf keynote D.java Turtle.java KitchenTurtle.java
Lecture 10. 29 September (Thursday). Recursion!
We
introduce recursion: a method calling itself. This provides power and
flexibility that we haven't had yet, and you will (should) be amazed at
how simple it will be to do neat things. pdf keynote 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. 27 September (Tuesday). Wrapper classes, class Vector, and more 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 algorithms dealing with Strings, showing you "top-down programming" and "stepwise refinement" in the context of a real java program. pdf ppt Anglicize.java AnglicizeTester.java
Lecture 08. 22 September (Thursday). Odds and ends
on classes. Stepwise refinement
We make some points about multiple constructors, overriding, and constructors in
subclasses. We then develop some more String functions and talk about stepwise refinement. pdf ppt 11sep22demo.zip
Lab 04. Writing functions. You will practice writing functions that deal with Strings. Please study the first part of the lab, on Strings and string equality, BEFORE Tuesday, so that you don't have to waste time in lab. This will help also in understanding Tuesday's lecture. An important point should become clear: a value of String is an object, so a test s == t where s and t are Strings tests whether they are the same folder or not. Method call s.equals(t) must be used to test whether two Strings have the same value. pdf docx Methods.java The Knack
Lecture 07. 20 September (Tuesday). Inside-out, super-this,
and stepwise refinement
We illustrate the inside-out
rule for referencing variables and methods, which is used in most programming
languages. We discuss this and super. The main topic is stepwise refinement --a way to think about the development
of methods from their specifications-- and develop String functions using it. pdf ppt
Lecture 06. 15 September (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 keynote Worker.java
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. 13 September (Tuesday). 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 Worker.java WorkerTester.java
Lecture 04. 08 September (Thursday). Customizing a
class: 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 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 03. 06 September (Tuesday). Customizing a class
We introduce the class definition, which describes
the format of all manila folders (object, instances) 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
Here is Richard Felder's website on learning styles: www4.ncsu.edu/unity/lockers/users/f/felder/public/Learning_Styles.html
Lecture 02. 01 September (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. pdf ppt
Lab 01. Java expressions. This lab involves practice with Java expressions and assignments using the DrJava Interactions pane. pdf html
Lecture 01. 30 August (Tuesday). Java types and expressions and the assignment statement We continue our discussion of Java types, expressions, variable declarations, and assignment statements. Lecture handout: pdf ppt pdfPres pptPres
Lecture 00. 25 August (Thursday). Course preliminaries; a few Java types
Introduction to the course: course objectives, ways in which we will help you succeed. Important administrative information. A little about some types (Sec. 1.1 of the text). Lecture handout: pdf ppt Jeannette Wing's article on computational thinking
FUTURE LECTURES AND LABS
This is the list from a previous semester. There will be changes, of course, but this gives you an idea of what will happen. Most of the links don't work.