You can override start/run methods in Thread because start and run methods in Thread class are not final methods.
Ex : isAlive(), stop(), suspend(), join() are final methods. So U can't override.
public class TempThread extends Thread
{
@Override
public synchronized void start() {
// TODO Auto-generated method stub
super.start();
}
@Override
public void run() {
// TODO Auto-generated method stub
super.run();
}
public static void main(String[] args)
{
TempThread t = new TempThread();
t.start();
t.run();
}
}
But as you asked about Overload
You can overload any of these methods.
Ex :
public class TempThread extends Thread
{
@Override
public synchronized void start() {
// TODO Auto-generated method stub
super.start();
}
@Override
public void run() {
// TODO Auto-generated method stub
super.run();
}
// ******** Overload **********
public synchronized void start(int i) {
// TODO Auto-generated method stub
super.start();
}
// ********* Overload **********
public void run(int i) {
// TODO Auto-generated method stub
super.run();
}
public static void main(String[] args)
{
TempThread t = new TempThread();
t.start();
t.run();
}
}
Note : Check the differences between overriding and overloading. That gives you better understanding about the issue.