Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Pet{ // Родительский класс
- String color;
- int age;
- int height;
- String race;
- public void sleep(){
- Display d =new Display();// Это мой класс для вывода текста, отсебятина.
- d.Out("Good night");
- }
- public void eat(){
- Display a =new Display();
- a.Out("I am very hungry, lets eat!");
- }
- }
- public class Fish extends Pet{ //класс наследник
- Fish myFish = new Fish();
- age = 10;
- Display g = new Display();
- g.Out(age);
- }
Advertisement
Add Comment
Please, Sign In to add comment