Hello,
The past week or 2, I've been trying to understand polymorphism, but i don't understand it still. Can someone give me good definition of polymorphism and if possible an example please ...
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.
Hello,
The past week or 2, I've been trying to understand polymorphism, but i don't understand it still. Can someone give me good definition of polymorphism and if possible an example please ...
Polymorphism basically is treating one type of object as another.
For example, a car is an automobile. A truck is also an automobile. thanks to polymorphism, we can treat a car as an automobile, and we can also treat a truck as an automobile. A boat is not an automobile. This allows us to write generic code which works for any type of automobile, and nothing else. We could even use a more generic category for vehicle which would include automobiles, boats, and airplanes.
Thread moved from "Whats wrong with my code?"