Please send questions to
st10@humboldt.edu .
CIS 480 - Advanced Java Programming
STUDY SUGGESTIONS for MIDTERM #2
* Midterm #2 will be held on Wednesday, April 18th.
* it will be in NHW 244;
* it will be open computer (you cannot e-mail anyone, but you
can look at the course Web page, BlueJ, the Java API etc.)
* you will be given a paper copy of the test, and
some code appearing within the test will also be available
from the course web page.
* You are responsible for material covered in assigned reading, in
lecture, and on the homeworks; the examples and the notes on the
course web page are, of course, also fair game.
* the intention is that the focus of the test questions will be
mostly on material covered since the Test #1 material; obviously,
however, a lot of this material is naturally cumulative. (For example,
if you are not comfortable with using frames, you might have trouble
with a test question involving a frame that does file I/O...)
* JDBC will *not* be included in this test. It *will* be on the final
exam, however.
* Some high points of what has been covered since Test #1:
* intro to threads
* may have to write, will have to read, will
have to answer questions about;
* what is a particular thread doing? How many
threads are there within an applet or application?
What happens in a particular thread when the
applet/application starts up, or when a certain
event occurs? What do you see when the applet/application
(containing threads) starts up? Etc.
* what is a thread? Why might it be useful? How
are they often used in Java?
* be able to modify given Thread-code for a stated
purpose; or fill-in-the-blank lines of code, perhaps.
* be able to read Thread code, describe what threads
are doing, or what it might do in a given scenario;
* which interface do you implement to have threads
within an applet? (Runnable);
* class Thread can be extended to create
threads as well;
* if you implement interface Runnable, what methods
must be implemented within such a class? (start(), run(),
stop())
* once a Thread instance is declared, how can it be
instantiated? started up? have its priorities set?
* how can you make a thread sleep for at least some
specified number of milliseconds? How does a thread
politely offer other threads a chance to run?
* what are the approved, non-deprecated ways of
"stopping", "suspending", and "resuming" threads?
* what is a ThreadLocal object? What is their
advantage? How does one set the value for such
an object? How does one find out the value for
such an object?
* how can one "animate" an image? How does one
"convert" a *.gif file into an Image instance?
How does one then paint/draw this Image, in AWT?
(within what method, using what method call?)
* double buffering
* should know how to do this; what are the necessary
steps?
* what problem are AWT animations sometimes
prone to, that double-buffering seeks to improve?
* why does this problem occur?
* how does double-buffering help?
* how can you create a "buffer" to draw to (instead
of the applet surface, for example), and how does one
then draw on the "buffer"?
* and, how does one then make the
completed "buffer" visible?
* when double buffering, what method do
you override? Why? What are its contents
when overridden?
* synchronized threads
* should be able to read and understand code
that uses synchronized threads (even if not much
experienced, necessarily, with writing such code);
* what are the semantics and syntax of a basic
synchronized block?
* if multiple threads have a synchronized block on
the same object, what can you guarantee?
* static methods and variables; final variables
* what does it mean for a method or variable to be
static?
* how can one call a static method from another
class?
* what does it mean for a variable to be
final?
* why/when would you want a variable to be
both static and final?
* finally clause
* what kind of statement is this clause associated
with?
* what are its semantics within that statement?
* if you were given an example, could you
tell what would happen when it was run?
* why is it particularly useful for
housecleaning details such as making
sure that files are closed?
* why is it different than simply
writing statements following the statement
in question?
* throwing an exception
* how does one throw an exception?
* what clause does one add to the method
definition of a method that can throw an
exception?
* File I/O
* should be able to perform simple file-related
activity and file i/o from a Java application, both
byte- and character-based.
* what is the Java package that contains classes
useful for file i/o?
* be comfortable with the File class (reading it,
writing it, being familiar with its basic capabilities)
* what does a File instance actually represent?
* what are some of the methods that the File
class provides?
* what abstraction does Java i/o follow (most commonly)?
* what is a stream? Does package java.io provide
very many stream classes?
* how does one "open" a stream? how does one close
a stream?
* can a file be opened for appending?
* in general, binary files are processed by subclasses
of what two java.io classes?
* in general, text files are processed by subclasses
of what two java.io classes?
* why are these more convenient for dealing
with text files?
* what are the buffered-version classes that are subclasses
of the superclasses?
* how are these buffered-version instances
typically instantiated?
* what particularly-convenient methods are
provided by the buffered-version classes for
handling text file i/o?
* how does Java represent characters?
* basically, how does one accomplish file i/o in
Java?
* what are some of the commonly-used methods for
file input and file output?
* are streams automatically closed when a Java program
ends? Are buffers automatically flushed?
* how can one close streams and flush
buffered streams?
* what kinds of exceptions can be involved in
file i/o?