I can not understand why the method say (String something) does not return "You do not know what the fish do not talk?"
There is a subclass of Fish
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 "Ты чё не знаешь, что рыбы не разговаривают?"; } } There is a main class FishMaster
public class FishMaster { public static void main(String[] args) { Fish myFish = new Fish(); myFish.dive(2); myFish.dive(3); myFish.sleep(); myFish.say("Привет"); } } There is a super pet class
public class Pet { int age; float weight; float height; String color; public void sleep(){ System.out.println("Спокойной ночи! До завтра"); } public void eat(){ System.out.println("Я очень голоден, давайте перекусим чипсами!"); } public String say(String aWord){ String petResponse = "Ну ладно!! " +aWord; return petResponse; } } There is a main class PetMaster
public class PetMaster { public static void main(String[] args) { String petReaction; Pet myPet = new Pet(); myPet.eat(); petReaction = myPet.say("Чик!! Чирик!!"); System.out.println(petReaction); myPet.sleep(); } } This is all code. It is taken from the book. In the book, the line "Do you not know what the fish do not speak?" Is displayed, but for some reason it does not appear in my book.
The program outputs: Dive to a depth of 2 feet I am at a depth of 2 feet below sea level Dive to a depth of 3 feet I am at a depth of 5 feet below sea level Good night! Till tomorrow
Fish myPet = new Fish();instead of Pet - VolArt