Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Polymorphism.

  1. #1
    Member
    Join Date
    Sep 2011
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Polymorphism.

    Hi,

    Im just trying to get the right idea about polymorphism.

    Is polymorphism simply the act of inheriting an abstract class and defining the methods yourself. As polymorphism means many forms, do we call this polymorphism because the abstract class can have many forms?

    Thanks.


  2. #2
    Member snowguy13's Avatar
    Join Date
    Nov 2011
    Location
    In Hyrule enjoying a chat with Demise and Ganondorf
    Posts
    339
    My Mood
    Happy
    Thanks
    31
    Thanked 48 Times in 42 Posts

    Default Re: Polymorphism.

    Umm... Close. First, the superclass doesn't have to be abstract for polymorphism to be relevant.

    The Oracle tutorials say that "Subclasses of a class can define their own unique behaviors and yet share some of the same functionality of the parent class."

    So, the methods and fields of the superclass are taking a different form in a new object defined by the subclass, yet they can have the same functions in the subclass as they do in the superclass. This idea also includes overriding and hiding methods and fields. Check out the Oracle tutorials on Polymorphism, as well as the Inheritance section.
    Use highlight tags to help others help you!

    [highlight=Java]Your prettily formatted code goes here[/highlight]

    Using these tags makes your code formatted, and helps everyone answer your questions more easily!




    Wanna hear something funny?

    Me too.

  3. #3
    Member
    Join Date
    Sep 2011
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Polymorphism.

    So polymorphism is the act of inheriting a class and overriding methods from it/adding to it, so making a class based on another. And as polymorphism means many forms, we call this polymorphism because the superclass can have many forms. Cheers!


    I read the links you posted, thanks.

Similar Threads

  1. assignment troubles polymorphism (guide for assignment included)
    By tdawg422 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 8th, 2011, 10:01 AM
  2. Polymorphism Question
    By kutysam in forum Java Theory & Questions
    Replies: 11
    Last Post: August 30th, 2011, 11:59 AM
  3. Polymorphism test
    By speedycerv in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 29th, 2011, 07:15 AM
  4. Polymorphism issue
    By LDM91 in forum Java Theory & Questions
    Replies: 5
    Last Post: November 28th, 2010, 02:26 PM