Welcome to CS61BL Grab lecture notes when you come in!!!

advertisement
Welcome to CS61BL
Grab lecture notes when you
come in!!!
And sit near someone else b/c
you’ll need to be able to talk to
them during lecture.
Colleen Lewis
ColleenL@berkeley.edu
Announcements
• Reading assignments are important, but they
won’t be announced in lecture.
– Do the reading!!!
• The course website:
– http://inst.eecs.berkeley.edu/~cs61b/su09/
• Sign-up for the google group
• If you weren’t in lab yesterday, talk to me after
class.
We can show you the world
Stacking, searching and queuing
Tell us, students, now when did
You last see such singing staff?
We can open your minds
Take you structure by structure
Linked lists, arrays, and... oh,
sure!
Even hash sets on the side.
A whole new world
A new fantastic paradigm
No one to tell you no
Or where to go
Or say you're only Scheme-ing.
A whole new world
A dazzling place you never knew
But when you're one week nine
You'll say it's fine
This can be done in Oh square of n.
(It can be done in big Oh of n!)
Unbelievable code
Indescribable coolness
For-loops, while-loops, and dowhiles,
Through an endless stream of
bytes.
A whole new world
(Don't you dare close your debugger!)
A hundred thousand things to see
(Save your folder - it gets better!)
There are bipartite graphs
Which can be halved
Very much like huge binary trees
A whole new world
(Every compile a surprise)
With amazing methods to pursue
(Every getter and setter)
We'll chase them anywhere
There's time to spare
Let us show inheritance to you
A whole new world
That's where we'll be
A thrilling chase
A wondrous place
For you and we
I want to make
some Person
objects
Give me a main
method!
Creates the file
Person.java
I want to make
some Person
objects
Everyone can
make these
Person objects
To make objects
I need a class
Start and end
the class
Everyone can call
this method
And they don’t
need a
Person first
And returns
nothing
Method
named main
That takes in
some
arguments
// Good looking
// comment!
// TODOs are your friend
Instance variables.
One per object!
You can even have
a reference to a
Person
Create a
reference to a
Person
Set your
reference to
point to your
object
Create a
Person
Person
myAge
myName
myParent
50
Susan Boyle
Constructor for
a Person
Set this’s
instance variables
Equivalent to the
3 lines before
Draw what
memory
looks like
at this
point!
Answer
main
susan
patrick
Person
myAge
myName
myParent
Person
myAge
myName
myParent
50
Susan Boyle
101
Patrick Boyle
Draw what
memory looks
like at this
point!
mystery
this
person2
main
susan
patrick
Person
myAge
myName
myParent
Person
myAge
myName
myParent
50
Susan Boyle
101
Patrick Boyle
mystery
this
person2
main
susan
patrick
Person
myAge
myName
myParent
Person
myAge
myName
myParent
Person
myAge
myName
myParent
1
This is
not my
parent
50
Susan Boyle
101
Patrick Boyle
Draw what
memory
looks like
at this
point!
You can’t
change
this!!!
Download