This website is preserved for historical and scholarly reference and is no longer actively maintained.

QUIZ 15

September 30, 1998



public class Association
{
public Association ( Object key, Object value )
// pre: key is non-null
// post: constructs a key-value pair
{
the Key = key;
theValue = value;
}

public Association ( Object key )
// pre: key is non-null
// post: constructs a key-value pair; value is null
{
this ( key, null );
}

.. // methods go here

protected Object theKey; // the key of the key-value pair
protected Object theValue; // the value of the key-value pair
}

#1. Explain the meaning of "this ( key, null )" in the second constructor. This explanation should include both the result of the statement and the mechanism by which it is accomplished.

#2. What is a package?

#3. Explain "protected" as explained in the text.




Return to Eleanor Hare's home page.

Return to Department of Computer Science Home page.