Skip to content
Advertisement

What is a supertype method?

I have googled couple of times but still can’t understand the supertype method. Can anyone please explain what is this?

Advertisement

Answer

There is a notion of supertype and subtype in OOPS, In java this kind of relationship is implemented by inheritance i.e. using extends keyword:

JavaScript

Any member (fields, methods) declared in super class is to be called supertype.

Therefore in above context if class A has method like

JavaScript

Set is supertype method for class B.

However, notice that if there is another class say C:

JavaScript

Then set() method is not supertype for C class because there is no relationship between class A and class C (relationship is created by extends keyword, for inheritance).

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement