Guest User

Untitled

a guest
Apr 24th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. package test;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. public class ThreadTest
  6. {
  7. public void startCPUHungryThread()
  8. {
  9. Runnable runnable = new Runnable(){
  10. public void run()
  11. {
  12. while(true)
  13. {
  14. }
  15. }
  16. };
  17. Thread thread = new Thread(runnable);
  18. thread.start();
  19. }
  20.  
  21. public static void main(String[] args)
  22. {
  23. ThreadTest thread = new ThreadTest();
  24. for (int i=0; i<2; i++)
  25. {
  26. thread.startCPUHungryThread();
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment