int ti = 0
System.out.print(ti instanceof int?true:false);查了下帖字,都说判断数据类型用 instanceof 。。怎么搞不定。。
Exception in thread "main" java.lang.Error: Unresolved compilation problem: Syntax error on token "int", Dimensions expected after this token

解决方案 »

  1.   

    instanceof 是用于判断类的
    不能用于基本类型用
      

  2.   

    回 windonly00(Only) 。恩,primitive 类型的数据类型应该怎么判断呢?一个text文本框,要求用户数据数据,如果输入number执行操作1
    如果输入text执行操作2
      

  3.   

    转换成功则为该类型?
    Integer.parseInt(ts);
    否则处理exception?
      

  4.   

    。。
    primitive 类型的数据类型应该怎么判断?一个text文本框,用户输入数据,如果输入number,程序执行操作1
    如果输入text   程序执行操作2怎么判断text中的数据类型?
      

  5.   

    转换成功则为该类型?
    Integer.parseInt(ts);
    否则处理exception?是可以的对字符串中一个个的字符进行分析也可以
      

  6.   

    instanceof 是用来判断两个类的一个类是否是另一个类的子类.