public class StoppHovedprogram { public static void main(String[ ] args) { new StoppHovedprogram(); } volatile boolean stopp = false; StoppHovedprogram ( ) { Runnable stp = new StoppRun(); new Thread(stp). start(); Thread.yield(); try {Thread.sleep(1);} catch(Exception e) { } stopp = true; System.out.println ("Main terminerer"); } class StoppRun implements Runnable { public void run(){ while( ! stopp) { System.out.println ("Jeg vil ikke stoppe"); } } } }