开发者

How to tell if a Java class is abstract?

Is there a way programmitcally to tell if a Java class is abstract? (Other than trying to instantiate and catching the error) T开发者_如何学运维hanks!


You can use reflection:

if (Modifier.isAbstract(FooBar.class.getModifiers())) {
    // ...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜