Multiple Choice
Consider the partial Date class below which represents a day of the year. public class Date
{
Private int month; // A value between 1 and 12
Private int day; // A value between 1 and the last day
// of the month
Public int getMonth() { return month; }
Public void setMonth(int newMonth)
{
If (newMonth >= 1 && newMonth <= 12) { month = newMonth; }
}
Public int getDay() { return day; }
Private int lastDayOfMonth()
{
Switch (month)
{
Case 9: case 4: case 6: case 11:
Return 30;
Case 2: return 28;
Default: return 31;
}
}
}
What type of method is getMonth?
A) mutator
B) constructor
C) accessor
Correct Answer:

Verified
Correct Answer:
Verified
Q10: Which of the following is one of
Q37: In Java, which of the following mechanisms
Q49: General Java variable naming conventions would suggest
Q60: Which of the following classes has a
Q65: Why can't Java methods change parameters of
Q76: A theater needs a TicketCounter to keep
Q77: Which of the following statements describes the
Q78: Pre- and postconditions may be viewed as
Q79: Consider the method signature in the following
Q85: Which statement will import the static methods