Thread Sample - IV


package thread4;

/**
 *
 * @author Nurhak
 */
public class Runner extends Thread {

    public Runner(String threadName) {
        super(threadName);
    }

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(i + " " + getName());

            try {
                sleep((int) (Math.random() * 1000));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        System.out.println("Destination--->" + getName());
    }
}


package thread4;

/**
 *
 * @author Nurhak
 */
public class Thread4 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        new Runner("izmir").start();
        new Runner("istanbul").start();
    }
}

Comments

Popular posts from this blog

Solution for the fault: "System.Diagnostics.Process.Start is not working on IIS, but working on ASP.NET Development Server"

Solution for "Can not obtain Oracle client information from registry"