Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BloodData {
- private String type;
- private String rH;
- // Overloaded constructor
- // this consturctor calls the parametrized constructor
- public BloodData() {
- this("O", "+");
- }
- public BloodData(String type, String rH) {
- this.type = type;
- this.rH = rH;
- }
- public String getType() {
- return type; // or return this.type;
- }
- public String getRH() {
- return rH; // or return this.rH;
- }
- public void setType(String type) {
- this.type = type;
- }
- public void setrH(String rH) {
- this.rH = rH;
- }
- @Override
- public String toString() {
- return "Your blood type is " + type + ", and your RH is " + rH + ".";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment