37 lines
1.1 KiB
Java
37 lines
1.1 KiB
Java
/**
|
|
* Answer to Question.
|
|
*
|
|
* Answer to Question 1:
|
|
*
|
|
* - Q: Should the getLegs methods be abstract? Why or why not?
|
|
*
|
|
* - A: Yes. Because different animal have different number of legs. In animal
|
|
* class we didn't define how many legs an animal has.
|
|
*
|
|
* - Q: Should the canFly methods be abstract? Why or why not?
|
|
*
|
|
* - A: Yes. Because different animal have different ability to fly. In animal
|
|
* class we didn't define how an animal can fly.
|
|
*
|
|
* - Q: Should the Animal class be abstract? Why or why not?
|
|
*
|
|
* - A: Yes. Because different animal have different properties. In animal class
|
|
* we didn't define how an animal is.
|
|
*
|
|
* - Q: What kinds of test can you write inside the testAnimal method?
|
|
*
|
|
* - A: You can write test for the getLegs and canFly methods. Before that, you
|
|
* need to inherit the Animal class and override the getLegs and canFly methods.
|
|
* Because the Animal class is abstract, you can't create an object of it.
|
|
*/
|
|
public class Start {
|
|
public static void main(String[] args) {
|
|
Animal.testAnimal();
|
|
Dog.testDog();
|
|
Bird.testBird();
|
|
Magpie.testMagpie();
|
|
Ostrich.testOstrich();
|
|
Pegasus.testPegasus();
|
|
}
|
|
}
|