Skip to content

Instantly share code, notes, and snippets.

@Yurlov
Created June 30, 2016 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yurlov/2aa1cb7d48328929739ac6a77ff93ce6 to your computer and use it in GitHub Desktop.
Save Yurlov/2aa1cb7d48328929739ac6a77ff93ce6 to your computer and use it in GitHub Desktop.
Prog.kiev.ua
class Animals {
private String name;
private int age;
private String color;
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBreed() {
return breed;
}
public void setBreed(String breed) {
this.breed = breed;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
@Override
public String toString(){
return "Имя : "+name;
}
}
public class Dog extends Animals {
public void getVoice(){
System.out.println(getName()+" Grrrrr");
}
public void getJump(){
System.out.println(getName()+" is jumping");
}
public void getBite(){
System.out.println(getName()+ " bites ");
}
public void getRun(){
System.out.println(getName()+" is running!");
}
}
public class Puppy extends Dog{
public static void main(String[] args) {
Puppy puppy = new Puppy();
puppy.setName("Ben");
System.out.println(puppy.toString());
puppy.getBite();
puppy.getRun();
puppy.getJump();
puppy.getVoice();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment