Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Which is better “implements Runnable” over “extends Thread” to write a thread in Java?

Damian99Damian99 USAMember Posts: 116
edited February 2014 in Java

I came to know that there are 2 ways to write a thread using Java.

#1
public class Thread1 implements Runnable { public void run() { //Code } }

#2
public class Thread2 extends Thread { public Thread2() { super("Thread2"); } public void run() { //Code } }

What is the best approach in terms of performance?

Tagged:

Comments

Sign In or Register to comment.