Advertisement
dig090

Thread to test control-c

Aug 1st, 2012
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. package com.j256;
  2.  
  3. public class Foo {
  4.  
  5.         public static void main(String[] args) {
  6.                 new Thread(new Runnable() {
  7.                         @Override
  8.                         public void run() {
  9.                                 while (true) {
  10.                                         System.out.println("...");
  11.                                         try {
  12.                                                 Thread.sleep(1000);
  13.                                         } catch (InterruptedException e) {
  14.                                                 e.printStackTrace();
  15.                                         }
  16.                                 }
  17.                         }
  18.                 }).start();
  19.         }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement