@@ -0,0 +1,1698 @@
+package threads.stopthread;%0A%0A/**%0A * Created by Sergey on 11.10.2017%0A *%0A * Class StopThread contains two main classes for task.%0A */%0Apublic class StopThread %7B%0A    /**%0A     * Variable time - contains exemplar class Thread in which we placed exemplar class Time.%0A     */%0A    Thread time = new Thread(new Time());%0A    /**%0A     * Variable countChar - contains exemplar class Thread in which we placed exemplar class CountChar.%0A     */%0A    Thread countChar = new Thread(new CountChar());%0A%0A    /**%0A     * method for get exemplar%0A     *%0A     * @return exemplar class Time%0A     */%0A    public Thread getTime() %7B%0A        return time;%0A    %7D%0A%0A    /**%0A     * method for get exemplar%0A     *%0A     * @return exemplar class CountChar%0A     */%0A    public Thread getCountChar() %7B%0A        return countChar;%0A    %7D%0A%0A    /**%0A     * Class Time count time from start program%0A     */%0A    public class Time implements Runnable %7B%0A        @Override%0A        public void run() %7B%0A            long start = System.currentTimeMillis();%0A            while (countChar.isAlive()) %7B%0A                if (System.currentTimeMillis() - start %3C 1000 && !time.isInterrupted()) %7B%0A                    time.interrupt();%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%0A    /**%0A     * Class CountChar count quantity characters%0A     */%0A    public class CountChar implements Runnable %7B%0A        @Override%0A        public void run() %7B%0A            String s = %22fdfdf gfgfg gfg d dff df  hhhhhhhhhgfgfg fgfg fg fg gf gfg fg fg df ggfg gffgfgfffggffggggfgfg%22;%0A            char%5B%5D chars = s.toCharArray();%0A            for (char c : chars) %7B%0A                if (time.isInterrupted()) %7B%0A                    break;%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

task 1019