开发者

How to tell if a Java class is abstract?

开发者 https://www.devze.com 2022-12-19 20:40 出处:网络
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:

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

精彩评论

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