title: End Java threads after a while statement has been run
body: <p>I am having an issue ending threads once my program my has finished. I run a threaded clock object and it works perfectly but I need to end all threads when the time ´==´ one hour that bit seems to work I just need to know how to end them. Here is an example of the code I have and this is the only thing that runs in the run method apart from one int defined above this code.</p>
  
  <pre><code>    @Override
      public void run()
      {
          int mins = 5;
          while(clock.getHour() != 1)
          {
              EnterCarPark();
              if(clock.getMin() &gt;= mins)
              {
                  System.out.println("Time: " + clock.getTime() + " " + entryPoint.getRoadName() + ": " + spaces.availablePermits() + " Spaces");
                  mins += 5;
              }
          }
      }
  </code></pre>
  
  <p>But when you keep watching the threads that are running in the debug mode of netbeans they keep running after an hour has passed not sure how to fix this. I have tried the interrupt call but it seems to do nothing. </p>
  
  <p><img src="https://i.stack.imgur.com/jwiqx.png" alt="enter image description here"> </p>