When working with Threads, it is fairly common to write something like this:
Runnable r = new Runnable()
{
public void run() { /* ... */ }
};
new Thread(r).start();
This is all nice and correct, but I believe the same could be achieved in a more performant and easy way:
new Thread()
{
public void run() { /* ... */ }
}.start();
However, I almost never see anything like this in code examples using Threads
and Runnable
. Is there any technical or style-related reason to use the first example instead of the second?