Advertisement
wingman007

Java2014OOP_Athlete

Dec 6th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. package myworld;
  8.  
  9. /**
  10.  *
  11.  * @author fmi
  12.  */
  13. public class Athlete extends Person {
  14.     private String sport;
  15.  
  16.     public String getSport() {
  17.         return sport;
  18.     }
  19.  
  20.     public void setSport(String sport) {
  21.         this.sport = sport;
  22.     }
  23.  
  24.     public Athlete(String sport, String name, int age) {
  25.         super(name, age);
  26.         this.sport = sport;
  27.     }
  28.  
  29.     @Override
  30.     public void introduceYorSelf() {
  31.         super.introduceYorSelf(); //To change body of generated methods, choose Tools | Templates.
  32.         System.out.println(" I am an Athlete. My sport is " + sport);      
  33.     }
  34.    
  35.    
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement