Final Review Notes

Here are some topics from the notes for the class. Questions can come from any of these. The final will be about the same length and complexity as the midterm. Probably the same kind of questions. If you have questions, ask.

Inheritance

Know how to express inheritance using the extends keyword. The child classes have access to the methods and data of the parent. Privates data and methods in the parent are still private to the child. Protected things are private to the outside world and public to the child classes. Inheritance passes down from parent to child to grandchild and so on. Child methods and data are not available to the parent. Know what the 'is-a' relationship is. Kind of as if the child had an instance of the parent inside it. Know what composition is and how it differs from inheritance. Know what the super reference is for. Know what an abstract class is. All Java objects inherit from Object. Know what an interface is. You have to implement all the methods in an interface.

Polymorphism

Many things with same name. A variable of the type of a parent class can be used to hold an instance of the child class. Carefully read the instrument example. Similar process works with interfaces.

Exceptions

Exceptions are thrown by system errors and by user generated errors. You can make your own exception classes. If exceptions are not caught, usually the program crashes. If an inner try block doesn't catch an exception, an outer try block can catch it. Multiple catches for a single try. Execution stops when an exception occurs and control transfers to the appropriate catch. Know what the finally clause is for.

I/O

I/O is modeled on streams. Think of pipes of data. Standard input is attached to the keyboard, standard out to the screen. Standard error usually goes to the same place as standard out. Files are opened by constructing objects. Carefully read the example code. Know about the exceptions that are possible.

Events

Examples of events, like, mouse click, window close, etc. What is a listener and how is it used? Know about the different ways to implement them. Inner classes or regular classes. Implementing the interface or extending the adaptor class. Anonymous class creation using the adaptors.

GUI

Know what buttons, text fields and labels are. Know about panels and how they are used. What is a layout manager and how to the common ones (FlowLayout, BorderLayout, Box Layout) differ. Panels can be inside other panels.

Inner Classes

Classes that are declared inside another class. Methods in them have same access privileges to the outer class data as the outer class methods do. Commonly used to implement listeners,

Threads

Threads are separate execution streams within a single operating system process. They are created and then passed an object that implements the Runnable interface. This has a method called run() that is executed by the thread. Know the sequence of thread steps.
init,start, stop, destroy.