1 package com.twister; 2 3 public class StopTheLoop { 4 static StopTheLoop looper; 5 6 public static void main(String[] args) { 7 looper = new StopTheLoop(); 8 looper = null; 9 do{ 10 System.out.println("Infinite Loop");; 11 }while(looper==null); 12 } 13 14 @Override 15 protected void finalize() throws Throwable { 16 looper = this; 17 } 18 }