| Author |
Need explanations of inheritance
|
Mahpara Chowdhury
Greenhorn
Joined: Oct 20, 2010
Posts: 2
|
|
facing problems in tracing INHERITANCE...need some examples with exlpanation....
|
Mahpara Hyder Chowdhury
|
 |
Saifuddin Merchant
Ranch Hand
Joined: Feb 08, 2009
Posts: 576
|
|
|
Tracing INHERITANCE? whats that??
|
Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32671
|
|
And welcome to the Ranch
As mentioned, there are different kinds of inheritance. Which do you mean?
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12921
|
|
Welcome to JavaRanch.
Have a look at Learning the Java Language in Oracle's Java Tutorials; it explains what objects, classes and interfaces are and what inheritance is.
Your question is broad and vague. If you want more specific answers, then please ask a more specific question.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Mahpara Chowdhury
Greenhorn
Joined: Oct 20, 2010
Posts: 2
|
|
well,here is an example that i can't figure out the exact output...
What is the output of the following code execution?
A a1 = new A(2);
B b1 = new B(3);
B b2 = new B(b1);
a1.methodB(1, 1);
b2.methodB(1, 2);
a1.methodB(3, 2);
b2.methodB(2, 2);
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Please UseCodeTags next time. I've added them for you this time.
Using the line numbers added by the code tags, which methods do you think are being called?
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32671
|
|
|
Also, to avoid copyright problems, please tell us where that code comes from.
|
 |
Saifuddin Merchant
Ranch Hand
Joined: Feb 08, 2009
Posts: 576
|
|
|
Why not run and see the output for yourself?
|
 |
 |
|
|
subject: Need explanations of inheritance
|
|
|