Advertisement
wingman007

2018_Java_Athlete

Oct 27th, 2018
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. package com.coolcsn;
  2.  
  3. public class Athlete extends Person {
  4.     private String sport;
  5.  
  6.     public String getSport() {
  7.         return sport;
  8.     }
  9.  
  10.     public void setSport(String sport) {
  11.         this.sport = sport;
  12.     }
  13.  
  14.     public Athlete(String name, int age, String sport) {
  15.         super(name, age);
  16.         this.sport = sport;
  17.     }
  18.  
  19.     @Override
  20.     public void introduceYourSelf() {
  21.         System.out.println("--------- I am an Athlete ------------");
  22.         super.introduceYourSelf();
  23.         System.out.printf(" My sport is %s\n", sport);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement