Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dziedziczenie;
- public class Animal {
- private boolean hasTail;
- private int weight;
- public void eat(){
- System.out.println("I'm eating now");
- }
- public void giveVoice(){
- System.out.println("I'm giving voice now");
- }
- public Animal(boolean hasTail, int weight) {
- super();
- this.hasTail = hasTail;
- this.weight = weight;
- }
- public Animal(){
- }
- }
- //-----------------------------------------------------
- class Dog extends Animal{
- private String owner;
- private String breed;
- private int age;
- public Dog(boolean hasTail, int weight,String owner, String breed, int age) {
- super(hasTail, weight);
- this.age=age;
- this.breed=breed;
- this.owner=owner;
- // TODO Auto-generated constructor stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment