posted 13 years ago
In the below code the Answer is B. My question is why didnt the year for d1 changed to 2000 like it did for d2?
Which one or more of the following correctly describe the behavior when this program is compiled and run?
a) compilation is successful and the output is:
d1 is Fri December 31 00:00:00 GMT 1999
d2 is Fri December 31 00:00:00 GMT 1999
b) compilation is successful and the output is:
d1 is Fri December 31 00:00:00 GMT 1999
d2 is Sun December 31 00:00:00 GMT 2000
c) compilation is successful and the output is:
d1 is Sun December 31 00:00:00 GMT 2000
d2 is Sun December 31 00:00:00 GMT 2000
d) the assignment 'd1 = d2' is rejected by the compiler because the Date class cannot overload the operator '='.
e) the expression (d1 is " + d1 + "\nd2 is " + d2) is rejected by the compiler because the Date class cannot overload the operator '+'.