|
|
class |
abstract class |
interface |
| Can it be instantiated? | Yes | No | No |
| Can it be extended? | Yes | Yes | Yes |
| Method body? | Must be { … } | May be { … } Must be ";" if declared abstract. |
Must be ";" Do not declare abstract because all methods are abstract implicitly. |
| Instance methods? | OK | OK | No |
| Static methods? | OK | OK | No |
| Abstract methods? | No | OK | All methods in interfaces are abstract implicitly. |
| Instance fields? | OK | OK | No. |
| Static fields? | OK | OK | Yes, but do not declare static because all fields are public, static, and final implicitly. |