Skip to content

Instantly share code, notes, and snippets.

@JorgeOlvera
Created April 28, 2014 14:05
Show Gist options
  • Save JorgeOlvera/11373152 to your computer and use it in GitHub Desktop.
Save JorgeOlvera/11373152 to your computer and use it in GitHub Desktop.
Date
import java.util.Scanner;
public class date
public static void main(String [] args){
Scanner input = new Scanner(System.in);
Date defaultDate = new Date();
Date ourDate = new Data(26, 3, 2014);
}
}
public class DateApp{
//Instance variables
public int day;
public int month;
public int year;
//Constructors
// 1st. Constructor without parameters
// Starts on 1/1/1890
public Date(){
day = 1;
month = 1;
year = 1890;
}
//2nd. Constructor with parameters
//Receives 3 params, all instance variables
public Date(int day, int month, int year){
this.day = day;
this.month = month;
this.year = year;
}
//Getters & Setters for each instance variable
public int getDay(){
return this.day;
}
public int setDay(){
return this.day;
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment