--Originally published at Alan TC201
First info taken from my previous Blog post. http://wp.me/p77XRU-u
Objects: Objects have states and behaviors, for example a car has stats like color, form, name and behaviors would be how fast it goes or how many gasoline it use.
Software objects also have a state and behavior. A software object’s state is stored in fields and behavior is shown via methods.
In software development, methods operate on the internal state of any object and the objects communicate by methods.
So in resume a method has a bunch of statements inside, and methods are what gives objects its particularities.
Class: A class is like a box that has inside has methods and those methods are affecting the objects inside the class
Now after all this information we can dig more in terms of Java programing, first of all, the term “encapsulation”.
This means that, to have a better program, that is easy to read, to understand and fix the classes need to be private, so that the methods of a class only affect the data or the objects inside that class.
Other term that plays in Object-Oriented programming is “inheritance”, this term tell us that we can “link” or transfer different methods between different classes that have similarities in them and use the same methods besides they use particularly methods. This helps to not duplicated methonds in diferent clases that have methods in commun.
If we couldn’t use Inheritance we will have to specify each method in each class we will have to explicit define each method in each class individually.
Multiple Inheritance means that a class have common things between two classes but those two classes don’t have Inheritance between them.
BUT BE CAREFUL, YOU DON’T CIRCULATE AN INHERITANCE, this means that a class cannot inheritance from itself, like a circle.
Overriding means that you could have different classes chain together and inheritance from the top one. For example, we have class, and we have a method call MON in the class V, normally all the classes below but if we have a method also call MON in the X class the the classes below X will inheritance the MON from the x class.
V – MON
W – MON FROM CLASS V
X – MON
Y – MON FORM CLASS X
Z – MON FROM CLASS X
Intarface is a set of methods that can have commun things inside different classes.
Here’s a video that explains everything with better examples.