Write code that creates an array of Dates with the name of \"dateArr\". Use the
ID: 3530953 • Letter: W
Question
Write code that creates an array of Dates with the name of "dateArr". Use the Date.java class found in chapter 5 of your textbook. An electronic version can be found on my web site under "Absolute Java text/chap05". The array should have 4 entries and the entries should be filled with Date classes representing the dates: May 16, 1984 November 14, 1978 September 21, 1980 July 3, 1987 Print the values of the dateArr array backwards. Your Date classes can be printed using the toString() method in the Date class.Explanation / Answer
public class Program
{
public static void main(String args[])
{
Date[] datearr = new Date[4];
datearr(0)=Date(1984,5,16);
datearr(1)=Date(1978,11,14);
datearr(2)=Date(1980,9,21);
datearr(3)=Date(1987,7,3);
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.