«

»

May
25

What do polymorphism, encapsulation and inheritance mean in Java?

  • Polymorphism : it means that an entity can be used under many forms. For example, if we have a method called method(), the polymorphism allows to use it with another implementation like : method(p1) or , method(p1, p2) or any other form using the same name method. This can be helpful for an developer, because he shouldn’t know the types or the number of  the parameters.
  • Encapsulation : it is a mechanism to  restrict access to object’s components by other objects. It is useful to change object’s data structure without changing its interface, so it isn’t necessary to change the classes using this interface. this mechanism imposes a loose coupling.
  • Inheritance : it allows the reuse of the object’s characteristics by another one and the object’s adaptability by using the polymorphism’s concept. Inheritance allows to child class to extends the properties of the mother class.

 

See also :

    Share it with your freinds on Facebook Tweet it to your freinds on Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

    5 comments

    No ping yet

    1. Monster Beats Studio says:

      What would be your next topic next week on your weblog?

    2. Javin @ java hashmap tutorial says:

      In my opinion polymorphism is great and if used correctly it gives you immense capability to write flexible and extensible code
      here are few benefits of polymorphism in my opinion:

      1) Runtime binding using method overridding.
      3) writing code for interfaces and not for implementation.

      By the way I have also shared my experience as What is polymorphism in Java , let me know how do you find it

      1. jalal mjadli says:

        Interesting comment…

    3. car repo says:

      your site is very cool! Impart, its time to go now for enjoying life in sunny day!

    4. iphone5reviewed.com says:

      most broadband services are crappy, they can’t maintain high data transfer rates~

    Leave a Reply

    Your email address will not be published.

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    WP SlimStat