Close: #1 Lab 7
This commit is contained in:
31
lab/lab7/Question1/Start.java
Normal file
31
lab/lab7/Question1/Start.java
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user