It really depends on the logic that the method implements. Sometimes it is called first, sometimes at the end, and sometimes never. For example, if some calculation from the superclass method is really important, then it will be called first. Or if the attempt to count is performed by the subclass method, but without a good result (the result is zero), an attempt is made according to the subclass method. There really is no good answer to this question, except that it really depends.
Example 1:
A label provider that extrapolates time from a Date object and returns it to the user interface for display:
public class TimeLabelProvider { public String getText(Date element) {
A label provider that extrapolates a date and time from a Date object and returns it to the user interface for display:
public class DateTimeLabelProvider extends TimeLabelProvider { @Override public String getText(Date element) {
Example 2:
If your project has a hierarchy of deep classes for user interface elements, for example
DropDownField extends TextField extends Field extends AbstractField
Now each of the classes added some interface elements to the field, for example, DropDownField added a menu and a little arrow to the right of the field, TextField added a validator, AbstractTextField added a white block for writing text, etc. To get rid of the elements, you will have to perform a multi-level deletion as follows:
public class DropDownField extends TextField { @Override public void dispose() { menu.dispose(); arrow.dispose();
darijan
source share