File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes What is Inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "What is Inheritance " Watch "What is Inheritance " New topic

What is Inheritance

Fred Man

Joined: Nov 07, 2005
Posts: 8
What is Inheritance in respect of classes. Can you give an example of code or give me an article Thank you

Just wanana say you people are excellent and this time in the subject I stated the subject I am going to discus about
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2398
Inheritance involves creating new class definitions by absorbing the characteristics of existing classes and adding additional functionality. Inheritance is a very useful tool since we build on class definitions that are presumably well-defined and tested and don't have to rewrite code.
Fred Man

Joined: Nov 07, 2005
Posts: 8
OK Good, now I know what is it one of the keyword is used for inheritance is extend what does this mean
Dani Atrei
Ranch Hand

Joined: Feb 17, 2004
Posts: 73
You define which is the subclass and which is the super class.

class Car extends Vehicle

Car = subclass
Vehicle = superclass
[ December 26, 2005: Message edited by: Dani Atrei ]

Si altas son las torres, el valor es alto - Alberti
u johansson
Ranch Hand

Joined: Dec 27, 2005
Posts: 47
If you extend a class you inherit both a type and an implementation.

If you implement an interface you inherit a type only.
I agree. Here's the link:
subject: What is Inheritance
It's not a secret anymore!