As soon as homework #1 is ready to be returned, I'll post to the
newsgroup and also note it in the announcements section. We plan to
have it ready by tomorrow. We'll also try to have homework #2 done by
Monday, so that you can look them over before the midterm on Tuesday. There were several of you asking about pairing up with someone from a different section for your programming partner. Currently, we are very hesitant to do this. Here's the deal: if you can find another pair of people from the same two sections who want to partner up, then we'll let you do it. For example, let's say you're in section A and you want to work with someone in section B. If you can find another person in section A who wants to work with someone in section B, then choose a representative among you four to send an e-mail to the six people involved: in this example, the two pairs of partners and the section A and B TAs. |
The concept that lies at the heart of object-oriented programming
(OOP) is that of encapsulation -- basically, logically grouping
all related data and functions into a single object. There are many
reasons for doing this:
These are the keywords in Java that are directly related to encapsulation: class, interface, public, protected, package, private, static. There are two levels of access protection that one can designate for objects. One can declare a protection scheme for the entire class, and one can declare a protection scheme for each member in the class. There are four protection schemes in Java:
protected members are visible to other members in that class and to any of its subclasses formed by inheritance. package is the default protection level given to those classes and members that do not have an explicit protection designation. (Therefore, you never explicitly write "package" to designate that protection scheme; however, you do write "package" to accomplish something else, which we'll discuss some other time.) Basically, you can designate a bunch of different classes as belonging to some package, and then all those classes in that package can access each other's package-level information, but those classes that are not in that package cannot. If you know about friends in C++, this is basically a cleaner implementation of that feature. More on this in some future section. private members are visible only to other members in that class.
|
Adam Berger, the section B TA, wrote up some nice review problems that you should try out in
preparing for Tuesday's midterm. Also, I highly recommend that you
try to do homework #3 before Tuesday; that will help you prepare for
the exam, too. Finally, there will probably be some TAs who will move
their office hours to Monday, so feel free to take advantage of that
to ask any last-minute questions. I won't be changing my office
hours, since it's before exam time anyway. I'll gladly entertain any
literally last-minute questions that you may have then. :)
|