容易出现的Java问题

  1、String s=null;
         System.out.println("s="+s.length());
         输入为:xception in thread "main" java.lang.NullPointerException
         注意:不是0. 这是一个运行时异常

2、String s;
       System.out.println("s="+s);
        这样会报出一个编译错误。错误为:The local variable s may not have been initialized

3、which three are valid declaraction of a float?
    A. float foo=-1;
    B. float foo=1.0;
    C. float foo=42e1;
    D. float foo=2.02f;
    E. float foo=3.03d;
    F. float foo=0x0123;
  G. float foo=139e1;
  Answer:A,D,F,G


你可能感兴趣的:(java,thread,C++,c,F#)