java - Why isn`t this method repeating forever? -


When I was joking, I found out something strange about the methods

  Public class T {static zero (M) (System.out.println ("M"); M1 ();} Fixed zero M1 () {System.out.println ("MM"); m ();} Public static zero main (string [] args) {m ();}}   

This code has no exception but it does not repeat forever

This code will not be compiled because you have a constant method is calling without a class example using a static method.

Once you fix it, you will end up with infinite recursion. / P>

On a typical JVM this code will eventually get out of the stack space. On a JVM that optimizes parsing recursion, the code will be equivalent to the infinite loop.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -