Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Fish.java
- public class Fish extends Pet {
- int currentDepth=0;
- public int dive(int howDeep) {
- currentDepth=currentDepth + howDeep;
- System.out.println("Ныряю на глубину " + howDeep + " футов");
- System.out.println("Я на глубине " + currentDepth + " футов ниже уровня моря");
- return currentDepth;
- }
- public String say(String something){
- return "Ты что не знаешь, что рыбы не разговаривают?";
- }
- }
- //FishMaster.java
- public class FishMaster {
- public static void main(String[] args) {
- Fish myFish = new Fish();
- myFish.dive(2);
- myFish.dive(3);
- myFish.sleep();
- myFish.say("Привет");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment