public class Date
{
private int day;
private int month;
private int year;
public Date() //default constructor
{
...
}
public Date(int mo, int da, int yr) //constructor
{
...
}
public int month() //returns month of Date
{
...
}
public int day() //returns day of Date
{
...
}
public int year() //returns year of Date
{
...
}
//Returns String representation of Date as "m/d/y", e.g. 4/18/1985.
public string toString()
{
...
}
}
The Date class is modified by adding the following mutator method:
public void addYears(int n) //add n years to date
Here is part of a poorly coded client program that uses the Date class:
public static void addCentury(Date recent, Date old)
{
old.addYears(100);
recent = old;
}
public static void main(String[] args)
{
Date oldDate = new Date(1, 13, 1900);
Date recentDate = null;
addCentury(recentDate, oldDate);
...
}
Which will be true after executing this code?
(A) A NullRefenceException is thrown.
(B) The oldDate object remains unchanged.
(C) recentDate is a null reference.
(D) recentDate refers to the same object as oldDate.
(E) recentDate refers to a separate object whose contents are the same as those of oldDate