Advertisement
Guest User

Untitled

a guest
Jul 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. //Created by Cody Smith
  2. //This program takes the dates and flips the order it prints out
  3.  
  4. package date_array;
  5.  
  6. class MyDate {
  7.     public int day;
  8.     public String month;
  9.     public int year;
  10.  
  11.     public MyDate(String month, int day, int year)
  12.     {
  13.         this.day = day;
  14.         this.month = month;
  15.         this.year = year;
  16.     }
  17.  
  18.     public String toString()
  19.     {
  20.         return (month + " " + day + " " + year);
  21.     }
  22.  
  23.     public class DateArray {
  24.         MyDate[] dateArr = new MyDate[4];{
  25.         dateArr[0] = new MyDate("May", 16,1984);
  26.         dateArr[1] = new MyDate("November", 14,1978);
  27.         dateArr[2] = new MyDate("September", 21,1980);
  28.         dateArr[3] = new MyDate("July", 3,1987);
  29.     }
  30.  
  31.     public void main(String[] args) {
  32.         MyDate[] dateArr = new MyDate[4];
  33.         dateArr.toString();
  34.     }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement