if I have class :
public class myclass{
public int calc(int var1,int var2){
return var1*var2;
}
public int calc(int var1 ,int var2 , int var3){
return var1*var2/var3;
}
}
Question is: is there any way if I want to override any method of my class
Example: I just made myclass extends Async and the doInBackground generate with the @Override annotation…
More Explain:
class ares extends AsyncTask<Params, Progress, Result> {
@Override
protected Result doInBackground(Params... params) {
// TODO Auto-generated method stub
return null;
}
}
I want when I made Sub Class extends myclass -> that calc method generates like doInBackground.
The annotation
@Overrideis not mandatory but optional and can be added automatically by your formatter of Eclipse.It is also possible, that you will get errors when you add this annotation if you use the JavaSDK 1.5 as this annotation was added for non-Interface methods with JavaSDK 1.6.
To enforce the generation or at least the error in Eclipse that the method is missing, you need to make the method abstract in your parent class. If you have done that, your IDE should assist you in generating the method and it should also add the annotation.