aspose file tools*
The moose likes Java in General and the fly likes Need explanations of inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need explanations of inheritance" Watch "Need explanations of inheritance" New topic
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: 597

Tracing INHERITANCE? whats that??


Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36579
    
  16
And welcome to the Ranch

As mentioned, there are different kinds of inheritance. Which do you mean?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13884
    
  10

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: 19556
    
  16

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 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36579
    
  16
Also, to avoid copyright problems, please tell us where that code comes from.
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 597

Why not run and see the output for yourself?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need explanations of inheritance
 
Similar Threads
In which situation i will use Abstract class and Inheritance.
Composition versus Inheritance
Realization/Generalization?
multiple inheritance in java
WA #1.....word association