Answers for "instances in java"

1

instances in java

Examples using a Date program 

private int m, d, y; 
	
	// default constructor
	public Date() {
		this.d = 1; // this instance of d is equal 1 
		this.m = 1; // this instance of m is equal to 1
		this.y = 2000; // this instance of y is equal to 2000
	}// date
	
	// usable constructor
	public Date(int month, int day, int year) {
		this.m = month; // this instance of month is equal to the inputted month
		this.d = day; // this instance of day is equal to the inputted day
		this.y = year; // this instance of year is equal to the inputted year
	}// date
Posted by: Guest on October-18-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language