我们有一个Java通讯员.NET“mustinherit”或“notinheritable”?

我们如何声明 Java中的某个类必须继承而不是直接从其自身实例化,或者相反,如何强制它不被继承?在.NET中,我们可以使用“mustinherit”和“notinheritable”修饰符.

解决方法

must be inherited and not directly instantiated from itself

把它抽象化.

or the opposite,how to force it not being inherited?

让它成为最终的.

相关文章

HashMap是Java中最常用的集合类框架,也是Java语言中非常典型...
在EffectiveJava中的第 36条中建议 用 EnumSet 替代位字段,...
介绍 注解是JDK1.5版本开始引入的一个特性,用于对代码进行说...
介绍 LinkedList同时实现了List接口和Deque接口,也就是说它...
介绍 TreeSet和TreeMap在Java里有着相同的实现,前者仅仅是对...
HashMap为什么线程不安全 put的不安全 由于多线程对HashMap进...