These are some things that I want you to especially notice as you look over the textbook chapters.
Almost everything here should be review. If any of these things are not review for you, please read those parts carefully and seek help from me or the F217 lab TAs as needed.
System.out.println()
and System.out.print()
=
(and the other =
operators, like +=
) return a value, so that z = x = Y+1;
is allowed. Type conversion operators, such as (double)
or (int)
&&
and ||
break
and continue
switch
? :
It is like if (..) .. else ..
, but it returns a value. For example,
(3 < 2) ? 4 : 5
evaluates to
5
Again, almost everything here should be review. If any of these things are not review for you, or if you don’t remember the details, read carefully and seek help as needed.
new
. The meaning of =
and ==
when applied to objects.
equals
and compareTo
), length
, charAt
, substring
. Also look up the StringBuilder
class in the JDK documentation.
2.4
Declaring an array of objects does not create an actual array object; use new
. If the base type of the array is an object type, all of the array entries are initially null
, unless that array is created by an initializer. =
copies an array reference, not the array itself.
Dynamic array expansion is the most important thing in this chapter.
Figure 2.6:
InputStreamReader
and BufferedReader
wrappers for System.in
. For now, think of lines 12–13 as a magic incantation for setting up line-by-line input.
Scanner
class from JDK 1.5
resize()
works (Figure 2.7).
resize
is called with argument array.length * 2
Ragged 2D arrays
try
, catch
, finally
, throw
, throws
. runtime exceptions, checked exceptions, errors.
StringTokenizer
, opening files for reading and writing. (Again, Scanner
from JDK 1.5 might be better here.)
Even more of this Chapter should be review.
this
, static
fields and methods, instanceof
, static
initializers.
Weiss condenses the most important concepts in object-oriented programming into this single key chapter.
public
, private
, protected
, package (default) visibility), type compatibility, dynamic binding and polymorphism, IS-A vs. HAS-A, use of super
in constructors and methods, final
methods and classes, the need for class cast, abstract classes and methods.
Object
class, decorator pattern and its application to I/O classes.
Comparable
vs. Comparator
. Local, nested, and anonymous classes.
Much, but not all, of the material in this chapter should be review. I list the review items here. We will cover the rest of the chapter in this course.
You should know the main data structures, interfaces, and classes of the Collections API
weiss.nonstandard
package.
Arrays
and Collections
classes). Comparators
.
ArrayList
s and LinkedList
s.
Arrays
class).
Recursion and induction
Sorting
Arrays
class).