I have updated in http://www.freejavaclass.com/
The Object Oriented Programming Languages directly represent the real life objects like Car, Jeep, Account, Customer etc. The features of the OO programming languages like polymorphism, inheritance and encapsulation make it powerful. [Tip: remember pie which, stands for Polymorphism, Inheritance and Encapsulation are the 3 pillars of OOPL]
Inheritance: The main purpose of inheritance is code reusability. In java we can achieve this by two ways,
• In has-a relationship you can achieve code reusability but can’t achieve polymorphism, the one way to achieve polymorphism is use interface implementation in your design.
Polymorphism: The ability of one object reference will hold the address of another object in the same inheritance hierarchy and capable of executing the method in the address holding object at runtime. The benefit of polymorphism is that it is very easy to add new classes of derived objects without breaking the calling code.
Encapsulation: Refers to keeping all the related members (variables and methods) together in an object. Being able to encapsulate members of a class is important for security and integrity and also improves code modularity by preventing objects interacting with each other in an unexpected way.
Subscribe to:
Post Comments (Atom)
How can instantiate Java interface without implementing.
public interface Foo { String method(); } public class Claaa { public static void main(String[] args) { Foo fooByIC...
-
1) Download docker for windows and don't install. 2) Restart the machine and enable "Virtualilaization" in BIOS settings 3) ...
-
http://freejavaclass.com/articles/j2ee/hibernate/multiple_persistence_unit_in_jpa.jsp
-
I have updated in http://www.freejavaclass.com/ final : final keyword can be used for class, method and variables. A final class cannot b...
No comments:
Post a Comment