Thursday, February 6, 2014

Java - Runnable and Thread

class RunnableImplements implements Runnable {

public void run() {
System.out.println("Runnable");
}
}

class ThreadExtends extends Thread {

public void run() {
System.out.println("Thread");
}
}

public class Test {

public static void main(String[] args) {
RunnableImplements runnableImplements = new RunnableImplements();
ThreadExtends threadExtends = new ThreadExtends();

new Thread(runnableImplements).start();
threadExtends.start();
}
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.