Defining Thread.run()
public class MyThread extends Thread {
public void run(){
System.out.println("MyThread running");
}
}
MyThread myThread = new MyThread();
myTread.start();
Defining Runnable
Runnable myRunnable = new Runnable(){
public void run(){
System.out.println("Runnable running");
}
}
Thread thread = new Thread(myRunnable);
thread.start();
http://tutorials.jenkov.com/java-concurrency/creating-and-starting-threads.html
No comments:
Post a Comment