package com.javarush.task.task14.task1401; //He who observes the day, observes it to the Lord; and he who does not observe the day, to the Lord he does not observe it. //He who eats, eats to the Lord, for he gives God thanks. He who doesn't eat, to the Lord he doesn't eat, //and gives God thanks. (Romans 14:6) /* Bingo! */ public class Solution { public static void main(String[] args) { Object animal = new Tiger(); boolean isCat = animal instanceof Cat; boolean isTiger = animal instanceof Tiger; boolean isPet = animal instanceof Pet; printResults(isCat, isTiger, isPet); } private static void printResults(boolean cat, boolean tiger, boolean pet) { if (cat && tiger && pet) System.out.println("Bingo!"); } static class Pet { } static class Cat extends Pet { } static class Tiger extends Cat { } } /* Bingo! ÐÑпÑÐ°Ð²Ñ ÑÑÑоÑÐºÑ âObject animal = new Pet();â в меÑоде main Ñак, ÑÑÐ¾Ð±Ñ Ð¿ÑогÑамма вÑвела «Bingo!«. ТÑебованиÑ: 1.âÐлаÑÑ Cat должен наÑледоваÑÑÑÑ Ð¾Ñ ÐºÐ»Ð°ÑÑа Pet. 2.âÐлаÑÑ Tiger должен наÑледоваÑÑÑÑ Ð¾Ñ ÐºÐ»Ð°ÑÑа Cat. 3.âРпеÑеменной animal должен Ñ ÑаниÑÑÑÑ Ð¾Ð±ÑÐµÐºÑ ÐºÐ¾ÑоÑÑй бÑÐ´ÐµÑ Ð¾Ð´Ð½Ð¾Ð²Ñеменно ÑвлÑÑÑÑÑ Ð¸ Pet, и Cat, и Tiger. 4.âÐÑогÑамма должна вÑводиÑÑ Ð½Ð° ÑкÑан: "Bingo!". package com.javarush.task.task14.task1401; * Bingo! * public class Solution { public static void main(String[] args) { Object animal = new Pet(); boolean isCat = animal instanceof Cat; boolean isTiger = animal instanceof Tiger; boolean isPet = animal instanceof Pet; printResults(isCat, isTiger, isPet); } private static void printResults(boolean cat, boolean tiger, boolean pet) { if (cat && tiger && pet) System.out.println("Bingo!"); } static class Pet { } static class Cat extends Pet { } static class Tiger extends Cat { } } */