I know java doesnot support multiple inheritence.lets say my class A extends B.Now my class A is extending class B as well as Object Class .how this happens?Why class A gets compiled?
sarath.koiloth 0 Light Poster
Recommended Answers
Jump to PostYou can inherit from a single parent downwards as far as you want...
A extends Object; B extends A; C extends B; etc
Thus, by implication, C extends B, A, and Object.
What you can't do is this:
E extends F,G
ie. extend from two parents at the same level. …
Jump to PostIn effect, if your class does not explicity specify an "extends" superclass, then the superclass is taken to be Object. It's that simple.
Jump to PostIt's single inheritance. Each class inherits from 1 class only, but that class, in turn,inherits from one class, etc, all the way up to Object.
When your code refers to a method or variable in a class Java looks for that method/variable in the class definition. If it finds it, …
All 11 Replies
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
jmaat7 0 Light Poster
BestJewSinceJC 700 Posting Maven
sarath.koiloth 0 Light Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
sarath.koiloth 0 Light Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
sarath.koiloth 0 Light Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
sarath.koiloth 0 Light Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.