「Java」「abstract」 Chapter4 Question10
Question:
A valid reason to declare a class as abstract is to:
Mutiple:
1. define methods within a parent class, which may not be overridden in a child class.
2. define common method signatures in a class, while forcing child classes to contain unique method implementations.
3. prevent instance variable from being accessed.
4. prevent a class from being extended.
5. define a class that prevent variable state from being stored when object Instances are serialized.
6. define a class with methods that cannot be concurrently called by multiple threads.
Answer:
2.
reason:
抽象類別的抽象方法,會迫使子類別提供實作。
A valid reason to declare a class as abstract is to:
Mutiple:
1. define methods within a parent class, which may not be overridden in a child class.
2. define common method signatures in a class, while forcing child classes to contain unique method implementations.
3. prevent instance variable from being accessed.
4. prevent a class from being extended.
5. define a class that prevent variable state from being stored when object Instances are serialized.
6. define a class with methods that cannot be concurrently called by multiple threads.
Answer:
2.
reason:
抽象類別的抽象方法,會迫使子類別提供實作。
留言
張貼留言