This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes inheriting a class 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 » Beginning Java
Bookmark "inheriting a class" Watch "inheriting a class" New topic
Author

inheriting a class

Kevin Knowles
Ranch Hand

Joined: Dec 29, 2002
Posts: 45
Will someone please give me a hint on how I can get my parent class to inherit another class, for example, the chart data structure?
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1815

Of course, if you want to use an interface, use "implements" in the class declaration. A class can extend at most one other class (and, in fact, has to...if you don't declare a super class, you by default get the "Object" class as your super class. The Object class is the only class that does not have a super class.) However, it can implement any number of interfaces:

Of course, don't confuse the "is-a" with the "has-a" relationship. A HomoSapiens is a Chordata (going back enough super classes); but it has a Spine (making it a member of the Vertebrata sub-phylum, but that's a bit too involved for this example... )
I hope that this answers your question and does not confuse you further...


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Greg Brouelette
Ranch Hand

Joined: Jan 23, 2002
Posts: 144
Go to http://mindview.net/Books and download the excelent free book "Thinking In Java". Then get the example code as well. Bruce Eckel wrote a very good chapter on inheiritence and Object Oriented Design. Work through the first 3 or 4 chapters of that book and you'll understand it perfectly.
Hope it helps.
Greg


For a good Prime, call:<br />29819592777931214269172453467810429868925511217482600306406141434158089
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: inheriting a class
 
Similar Threads
andrew has wii
can non-static inner class access any member
Doubt about diagram class (realization)
Doubt about diagram class
WA #1.....word association