Guest User

Untitled

a guest
Apr 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. package HW11;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6. import java.util.Scanner;
  7.  
  8. public class Spam extends Thread{
  9. public void Spams(int msc[],String msg[]) throws InterruptedException {
  10. while (true) {
  11. for (int i = 0; i < msc.length; i++) {
  12. int ms[];
  13. String posts[];
  14. ms = new int[msc.length];
  15. posts = new String[msg.length];
  16. ms[i] = msc[i];
  17. posts[i] = msg[i];
  18. Thread.sleep(ms[i]);
  19. System.out.println(posts[i]);
  20. }
  21. }
  22. }
  23. }
  24. class mThread extends Thread{
  25. @Override
  26. public void run(){
  27. int k[]={500,5000};
  28. String a[]={"hi","Ss"};
  29. Spam t1 = new Spam();
  30. try {
  31. t1.Spams(k, a);
  32. }catch (InterruptedException e){
  33. System.out.println("Программа завершена");
  34. }
  35. }
  36. }
  37. class Tst1 {
  38. public static void main(String[] args) {
  39.  
  40. mThread myThread = new mThread();
  41. myThread.start();
  42. // try {
  43. // Thread.sleep(3000);
  44. // } catch (InterruptedException e) {
  45. // e.printStackTrace();
  46. // }
  47. // myThread.interrupt();
  48. }
  49. }
Add Comment
Please, Sign In to add comment