char tt = '1';
        System.out.printf("%c",tt++);  输出是什么?我说的输出时1,面试者告诉我是2.以下垃圾回收的标准时什么?
       Object obj = new Object();
       Object obj = null;
       Object obj = new Object();
       obj = new Object();
这个题我当时就说会报错。面试的告诉我这个运行没问题。
其他问题就是不说了。哎

解决方案 »

  1.   

    有%c,C语言? 
    C语言输出不是这样的
      

  2.   

    现在某些公司的HR,男的闲的蛋疼,女的闲的B痒痒...
      

  3.   

    因为 输出那里有个 “ tt++”    所有 是先加 再输出  所以是2   
       如果是 "++tt" 的话  就是 先输出  再 加   那就有可能是1 
      

  4.   

    in java the mathematical calculation of character is possible, so the output of the first one should be 2, "tt++" make the output to be 2, if "++tt", then should be 1.
    For the second one, all the instances have the same name. Thus by each new creation, the last one will be crashed. The last row "obj=new Object()" create a valid Instance of Object, because the "obj" has been declared and already created throug "Object obj=new Object()".
      

  5.   

    ++在后,不是应该先输出后加1吗?已经定义过一个Object类型的obj,再定义一个不会错???是我无知了吗???
      

  6.   

    这题真TMD搞~...
    估计那HR都跟7楼那样儿~
      

  7.   

    public class Test {    public static void main(String args[]) {        char tt = '1';
            System.out.printf("%c",tt++);
        }}结果是1  
    这种问题也会是面试题?
      

  8.   

    有谁能告诉我 printf 是什么意思  怎么输出的 
      

  9.   

    I did some mistakes in my reply, the first one must be 1, 2 can be just with the code "++tt". And also some explanation about my reply for the second one,  I think the general ideas is to test the knowledge on object oriented thinking, so if the code is "Object obj=new Object(); obj=null; obj=new Object()" could be better. If the original code is as such thing, I don't think it works. Finally, System.out.printf() is a valid method in Java
      

  10.   

    我用jdk1.5去编译
    char tt = '1';
      System.out.printf("%c",tt++);
    明明是1。 
      

  11.   

    ++i和i++的老问题了 谁在前边 就操作谁么现在想想 其实也可以这样理解 ++i 是一个表达式 表达式有返回值 i是一个变量 也有自己的值 不知道这个理解对还是错了
      

  12.   

    public class Test {
        int test;
        public Test() {
            test=1;
        }    public static void main(String[] args) {
            
            char c='1';
            System.out.printf("%c",++c);//output is 2
            System.out.printf("%c",c++);//output is 1
            
            Test mt=new Test();
            System.out.println("now mt 1 is "+mt.toString());//a created object
            mt=null; //set the created object as null
            mt=new Test();//another object, although with the same name, 
                          //but different memory space
            System.out.println("now mt 3 is "+mt.toString());
        }
    }If somebody is interested, you can run the code by yourself and check the output. The HR-guy may do something wrong with the paper work and forget the basic knowledge as me. Sorry about my reply.
      

  13.   

    原来java里char型也可以计算的。记得在在C里,++在前是先加再赋值或者输出,在后,则先输出后加,难道java里不一样?
      

  14.   

    char tt = '1';
     System.out.printf("%c",tt++); ====>1
     System.out.printf("%c",++tt); ====>3   Object obj = new Object();
      Object obj = null;          ==>报错
      Object obj = new Object();  ==>报错
      obj = new Object(); 
    我觉得面试官是试探LZ的 看看LZ的基础扎实不