If I didn't know that the sleep
method on java.lang.Thread 开发者_StackOverflowwas static, how could I find out?
Use getModifiers
on the Method
object:
Method meth = ...;
if (Modifiers.isStatic(meth.getModifiers())) {
// method is static
}
use
(myclass.getModifiers() & Modifier.STATIC) != 0
精彩评论