好像是用什么instanceof ,可以举个例子吗?

解决方案 »

  1.   

    好像是这样吧Object ob = new Object("ok") ;if (ob instanceof Object)
      System.out.println("ob is instance of class Object.") ;
    else
      System.out.println("ob is not instance of class Object.") ;
      

  2.   

    看这个:
    http://www.51windows.net/pages/jscript5/?url=/pages/jscript5/html/jsoprinstanceof.htm
      

  3.   

    public class Test {
    public static void main(String[] args){
    Object obj=new Test();
    if(obj instanceof Test){
    System.out.println("obj is class of Test!");
    }
    }}