runtime exception与Compile time error有什么区别!请举些例子....

解决方案 »

  1.   

    Compile time error = 编译时的异常 ,一般的编辑工具,比如eclipse,就会提示你了,表示你的程序有语法错误.
    runtime exception = 运行时异常,你运行的时候才会发现.public class Test
    {
    public static void main(String[] arg)
    {
    String s = null;    /*对null是不能有length()操作的.但下面的length()操作并不知道你
                          这里的s是不是null . 这个程序能通过编译,没有语法错误. 
                                          但是在运行的时候就会报异常 */
                    System.out.println(s.length());
    }
    }
      

  2.   

    runtime exeception: java Main
    compile time error: javac Main.java