/* * Author: CHEN Yongyuan (Walter) 1930006025 from OOP(1007) * Date: 2022/04/03 * Description: This is the class of Magpie, which is a child class of Brid. */ public class Magpie extends Bird { /** * Constructor. Magpie always have 6 eggs. * * @param name */ public Magpie(String name) { super(name, 6); } /** * Magpie can fly. * * @return true */ @Override public boolean canFly() { return true; } /** * Test. */ public static void testMagpie() { Bird bird = new Magpie("Magpie"); System.out.println(bird.getName() == "Magpie"); System.out.println(bird.getNumOfEggs() == 6); System.out.println(bird.canFly() == true); System.out.println(bird.getLegs() == 2); } }