I'm currently learning about thread in Java and I saw these examples on the net.
Thread t1 = new Thread(new Runnable() {
@Override
public void run() {
//code....
}
});
and
Thread t2 = new Thread() {
@Override
public void run() {
//code....
}
};
What's the differences between creating thread with and without creating anonymous runnable? Which one is correct way to use a thread?