Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. public class Mojwatek implements Runnable {
  2. @Override
  3. public void run() {
  4. try {
  5. Thread.sleep(10000);
  6. } catch (InterruptedException ex) {
  7. System.out.println(ex.toString());
  8. }
  9. catch (Exception e)
  10. {
  11. System.out.println(e.toString());
  12. }
  13. }
  14. }
  15.  
  16.  
  17. ---------------------------------------------
  18.  
  19. public class Main {
  20.  
  21. public static void main(String[] args) {
  22. Mojwatek w1 = new Mojwatek();
  23. int x=0;
  24. while (true)
  25. {
  26. Thread temp = new Thread(w1);
  27. temp.start();
  28. x++;
  29. System.out.println(x);
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement