How do you crash a JVM?

前端 未结 27 1468
故里飘歌
故里飘歌 2020-11-28 00:22

I was reading a book on programming skills wherein the author asks the interviewee, \"How do you crash a JVM?\" I thought that you could do so by writing an infinite for-loo

27条回答
  •  佛祖请我去吃肉
    2020-11-28 00:59

    If a 'Crash' is anything that interrupts the jvm/program from normal termination, then an Un-handled exception could do this.

    public static void main(String args[]){
       int i = 1/0;
       System.out.print(i); // This part will not be executed due to above  unhandled exception
      }
    

    So, it depends on what type of CRASH ?!

提交回复
热议问题