I am very intersted in Polymorphism and Inheritance in C++. I wonder if there is such examples in Java( note I am just beginnning to learn it, and I find it really hard to read from JDK documentation ) and what are the best examples of Polymorphism in Java(JDK Classes to look for )? Thanks.
Asked
Active
Viewed 420 times
0
-
1Have you read [The Java Tutorials - Polymorphism](http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html)? – Elliott Frisch Nov 02 '14 at 01:38
-
1I did. But I wanted to know what Classes in JDK are bearers of Polymorphism so that I can take a look in the code and see how it is being processed. I know what Polymorphism is from C++, I just need to see how it is being handle in Java. – truе Nov 02 '14 at 01:42
-
3Look at class Number and its subclasses, Integer, Byte, Double, etc. Java also has interfaces for polymorphism so look at CharSequence and is implementations - CharBuffer, Segment, String, StringBuffer, StringBuilder – Scooter Nov 02 '14 at 01:43
-
Swing has a huge hierarchy of objects. You can start at [JComponent](http://docs.oracle.com/javase/7/docs/api/javax/swing/JComponent.html) and just drill down. – markspace Nov 02 '14 at 02:17
-
See this example http://stackoverflow.com/a/154939/837765 – Pier-Alexandre Bouchard Nov 02 '14 at 05:09