Java中有Integer这个类,不过你说的Instance就不知道是什么了!

解决方案 »

  1.   

    Integer t=new Integer(5);
    if (t instance Integer)
    {
        System.out.println("t是个整数");
    }
    else
    {
        System.out.println("t不是个整数");
    }
    ---------------
    这样对不对???
      

  2.   

    这个我知道!if (t instance Integer)这个什么意思??
      

  3.   

    我试过了,if(t instance Integer) 这个是错误的,
    改成if(t instanceof Integer)这样就对了!!
    instanceof 是判断 t 是否为Integer的一个实例的!