Created
June 1, 2013 03:00
-
-
Save kevindoran/5689144 to your computer and use it in GitHub Desktop.
Dragon class. This class is used to demonstrate Java Serialization aspects.
This file contains 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 class Dragon implements Serializable { | |
private static final long serialVersionUID = 1L; | |
private double wingSpan; | |
private String name; | |
public Dragon(double wingSpan, String name) { | |
// Input checks. For example, insuring wing size is greater than zero. | |
this.wingSpan = wingSpan; | |
this.name = name; | |
} | |
public double getWingSpan() { | |
return wingSpan; | |
} | |
public double getSpeed() { | |
double speed = (wingSpan * 3.14) + 5; | |
return speed; | |
} | |
public String getName() { | |
return name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment