KnowledgeBoat Logo
|
LoginJOIN NOW

Computer Applications

Define a constructor function for a Date class that initializes the Date objects with given initial values. In case initial values are not provided, it should initialize the object with default values.

Java Constructors

10 Likes

Answer

public Date()
{
    day = 1;
    month = 1;
    year = 1970;
}
public Date(int d, int m, int y)
{
    day = d;
    month = m;
    year = y;
}

Answered By

6 Likes


Related Questions