For the following program, explain the interesting lines of code related to threads and explain the output of the application (do not show the output, just explain it). You may experiment with the program using the attached source code by copying and pasting it into your IDE. 1 public class TaskThreadDemo { 2 public static void main (String args []) { 3 String [] sa = {"a", "X", "+", "."}; 4 for (String s: sa) { 5 Runnable ps = new PrintChar (s, 200); 6 Thread ts = new Thread (ps, s); 7 ts.start (); 8 } // end for each character 9 } // end main 10 } // end class TaskThreadDemo 11 12 class PrintChar implements Runnable { 13 String ch; 14 int times; 15 16 public PrintChar (String c, int n) { 17 ch = c; 18 times = n; 19 } // end constructor 20 21 public void run () { 22 for (int i = 0; i
Get Free Quote!
325 Experts Online