Problem of instanceOf

Posted by eric2323223 on Stack Overflow See other posts from Stack Overflow or by eric2323223
Published on 2010-04-07T07:22:40Z Indexed on 2010/04/07 7:33 UTC
Read the original article Hit count: 445

Filed under:
|
|

Hi, could anyone tell me why this code won't compile?

    public boolean isOf(Class clazz, Object obj){
        if(obj instanceof clazz){
            return true;
        }else{
            return false;
        }
    }

Why I can't pass a class variable to instanceOf?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about java

Related posts about class