Subject: What to do for the homework Re: HMWRK2 Question

From: Archisman Rudra <[email-masked]>
Date: Mon, 4 Oct 1999 23:25:16 -0400 (EDT)

Hi everyone,
      There seems to be quite a bit of confusion about the homework
and what to do. So I will try to answer the questions I have got in the
last two days.

     For the programming assignment, the code fragment defines the
interface for some implementation for the node class of some linked
list. Thus any node stores an item (which, bcause it can be anything
is of the class Object; remember that "anything" is a subclass of
Object). The other information necessary to traverse a link list
is the next pointer; and that is stored in the private member
next. Remember that objects are passed around as reference in java;
so unlike in C or Pascal, you don't have to explicitly declare a
pointer type, and dereference it when accessing.

     Furthermore, java allows polymorphism for member functions
(but not for operators; that is a C++ ugliness). Thus the member
function setItem is polymorphic.

    Question is, what is the intended meaning of the methods. Lets
take a look at what this class does. Remember, in a linked list we
want to be able to access the value at any node; or even change it
by assignment. However, since the member item is private, it can't
be accessed by anything outside. Thus we need the methods getItem
and setItem. Similarly, for the pointer; we have the member functions
getNext and setNext.

    The homework asks you to implement these methods and to fill in
the space for main so that it can be tested....

Hope this helps,
  Archi

> Archi,
> 
> Can you define what the methods are suppose to do specifically..
> 
> public void setItem(Object i);
> public void setItem(node n);
> public void setNext(node n);
> public node getNode();
> public object getItem();
> 
> 
> In the assignment it isn't specified exactly what should be done in each
> method...i can assume but i want to be right!
> 
> thank you
> mike
> 
>