Beruflich Dokumente
Kultur Dokumente
part
1
COMP
401,
Spring
2014
Lecture
8
2/4/2014
Common uses
In
this
case,
modify
the
declara;on
of
the
eld
with
the
keyword
nal
By
conven;on,
named
constants
are
ALL_CAPS
lec8.ex1
Common
uses
GeSers
/
SeSers
for
sta;c
class
elds
Helper
/
auxiliary
func;ons
Factory
methods
for
crea;ng
new
instances
Well
revisit
this
in
more
detail
later
later
in
the
class.
lec8.ex2
Mo;va;ng
Enumera;ons
OWen
need
to
model
part
of
an
object
as
one
value
from
a
set
of
nite
choices
Examples:
Example:
Recap
of
Interfaces
A
contract
for
behavior.
Dened
by
a
set
of
method
signatures.
Acts
as
a
data
type.
No
implementa;on.
Specic
classes
implement
the
interface
Inheritance
What
is
inheritance
in
real
life?
Characteris;cs
/
resources
that
you
receive
from
your
parents
Get
these
automa;cally.
Part
of
who
you
are.
Extending
Interfaces
Adds
methods
to
contract.
Original:
parent
interface,
super
interface
New:
subinterface,
child
interface,
extended
interface
Media
extends
Compressed
Media
Assignment
3
Pixel
iterator
should
NOT
make
a
copy
of
the
pixels
in
the
frame.
SHOULD
maintain
a
reference
to
the
frame
and
any
info
needed
to
keep
track
of
the
traversal.
Midterm
Logis;cs
Strongly
considering
moving
midterm
to
either
be
Thursday
or
Friday
during
recita;on.
Will
talk
to
TAs
on
Wed.
evening
and
will
have
a
decision
posted
that
night.
Closed
book
No
need
for
exam
book
or
scantron
Learning
accommoda;ons
Let
me
know
if
this
applies.
Take
the
test
at
learning
services.
Drop
it
o
at
my
oce.
Midterm
Part
1:
Mul;ple
choice,
true/false
Example:
Midterm
Part
2:
Short
answer
/
calcula;on
Evaluate
small
snippets
of
code
Example:
What
is
the
value
of
the
variable
bar
aWer
the
following
code
executes?
int bar; !
int[] a = {1, 2, 3, 4, 5}; !
int[] b = a; !
b[2] = a[1]; !
bar = a[2]; !
Midterm
Part
III:
Understanding
Code
Ill
provide
the
code
for
one
or
more
classes
and
then
ask
ques;ons
like:
Iden;fy
all
of
the
instance
elds
of
class
A.
Iden;fy
all
of
the
class
methods
of
class
A.
What
is
the
return
type
of
method
m
of
class
B?
Midterm
Part
IV:
Wri;ng
Code
Asked
to
dene
one
or
more
simple
classes
according
to
some
specica;on.
May
be
provided
with
a
par;al
implementa;on
that
you
have
to
complete.
Topics
/
Concepts
Basic
Java
syntax
Enumera;ons
Iterator
Constructor
Chaining
/
Method
Overloading