public class Test {

    public static void main(String[] args) 
    {
System.out.print(12 + 3);//输出的结果的数据类型怎么得到?
    }
}

解决方案 »

  1.   

    判断类型只能 instance of 大多数的框架判断未知类型都是这样做的。
      

  2.   

    SOUT 的输入出类型都是String!
      

  3.   

    是String类型的吧,参考
    public void print(int i)
    打印整数。按照平台的默认字节编码将 String.valueOf(int) 生成的字符串转换为字节,并完全以 write(int) 方法的方式写入这些字节。 
    调用Integer类中的toString()方法转换成String字符串
      

  4.   

    是要这东西???System.out.println(new Integer(12+3).getClass());
      

  5.   

    不是,那个结果应该是String类型,你这样得到的是Integer类型。
      

  6.   

    12+3是int。只不过print方法用String.valueOf把int转成了string
    看API:
        print    public void print(int i)    Prints an integer. The string produced by String.valueOf(int) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.    Parameters:
            i - The int to be printed
        See Also:
            Integer.toString(int)