Reputation: 1443
So I was reading the JPanel
API and saw the fields about inherited methods for example, and I saw three boxes of methods that JPanel
inherits. Now, knowing what I learned the first week of the Comp. Sci. intro class, JPanel
can only inherit methods from its superclass
, so then how does JPanel
seem to have three superclasses
? Am I reading this wrong, if so, how does JPanel
inherit from three different classes? Note, there are four boxes of inherited methods, but I know that everything descends from Object
, so I got that, what I don't understand is how JPanel can also be the subclass of the other three classes listed preceding Object
.
Again, probably the stupidest question to ever be asked, but I'm very confused.
Upvotes: 1
Views: 159
Reputation: 324127
So yes, JPanel inherits the methods from JComponent, Container, Component and Object.
This is the basis of inheritance
. Start with the Java tutorial on Object Oriented Programming Concepts.
Upvotes: 3