It has been suggested the accessor method below be added to the class to return the Date one day later than the given date. public Date getNextDate()
{
If (day == lastDayOfMonth() )
{
Month++;
If (month == 12) { month = 1; }
Day = 1;
}
Else { day++; }
Return this;
}
What is wrong with this design?
A) You cannot return this from a method.
B) It uses lastDayOfMonth, a private method of the class.
C) It has the side effect of changing the Date.
D) Since it returns a Date other than this one, the class is not consistent.
Correct Answer:
Verified
Q42: Which of the following statements regarding static
Q42: Where in a class should static variables
Q43: An AssertionError will be generated under which
Q44: The use of the static keyword in
Q46: Consider the partial Date class below which
Q48: Consider the method signature in the following
Q50: Which command would execute a program with
Q51: Which of the following statements is true
Q52: Which of the following statements describes an
Q55: Which of the following types of methods
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents