JavaRush /Java Blog /Random EN /Classes and interfaces. Trying to understand
varbandim
Level 9
Тверь

Classes and interfaces. Trying to understand

Published in the Random EN group
Interfaces vs. classes - review on Habré Interfaces in OOP (Java), in a simple way? — on the stack Classes and interfaces.  Trying to understand - 1It’s still not clear. Is an interface also a class that just describes additional methods for a class? If so, are the methods of the initial class simply not visible, or can they be used? Or do they need to be redefined? And if the interface is not a class, then it is simply a list of methods, united under one name, that can be used in any class, simply by defining which class they are used for? Or is it a group of methods that apply to a specific class? Then in a program a class variable with a specific interface can use both class methods and interface methods? Or just interface methods? Let's say there is a person class that has a Boolean movement method described. Can we apply a set of "legs", "wheels" methods with different types of movement to it? In this case, will the boolean method of the person class be visible through the “legs” or “wheels” interface? Or will it be other classes that we define for the variable: Человек Сэм = новый ЧеловекСНогами?And then we should have a class described ЧеловекСНогами? Or is it just a set of methods?
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION