Last active
January 30, 2017 10:53
-
-
Save kikoso/7f5b09b7f804653729760610c4921604 to your computer and use it in GitHub Desktop.
Immutable Star
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class Star { | |
/** | |
* Final and private attributes | |
*/ | |
private final double mass; | |
private final String name; | |
private final Date dateOfDiscovery; | |
public Star (double aMass, String aName, Date aDateOfDiscovery) { | |
mass = aMass; | |
name = aName; | |
dateOfDiscovery = new Date(aDateOfDiscovery.getTime()); | |
} | |
public double getMass() { | |
return mass; | |
} | |
public String getName() { | |
return name; | |
} | |
public Date getDateOfDiscovery() { | |
return new Date(dateOfDiscovery.getTime()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment