IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Java
Search Java Group:

Advanced
-Collapse +Expand Java To/From
To/FromCODEGuides
-Collapse +Expand Java Store
PRESTWOODSTORE

Prestwood eMagazine

March Edition
Subscribe now! It's Free!
Enter your email:

   ► KBProgrammingJavaStandard JavaLanguage Det...   Print This     
  From the January 2016 Issue of Prestwood eMag
 
Java Language Details:
Java Inheritance (extends ParentClass)
 
Posted 11 years ago on 10/23/2008 and updated 1/29/2009
Java Code Snippet:
 A flashcard from our Java Flashcards Library
 A code snippet from our Java Code Snippets Page
 Tags: Java , Inheritance

KB101392



General Info: Inheritance

The concept of a class makes it possible to define subclasses that share some or all of the main class characteristics. This is called inheritance. Inheritance also allows you to reuse code more efficiently. In a class tree, inheritance is used to design classes vertically. (You can use Interfaces to design classes horizontally within a class tree.) With inheritance, you are defining an "is-a" relationship (i.e. a chow is-a dog). Analysts using UML call this generalization where you generalize specific classes into general parent classes.

Java Inheritance

Simple syntax example of class inheritance.

Syntax Example:

In the following example, a terminator T-600 is-an android. 

public class Android {
}
 
public class T-600 extends Android {
}

Class Scope Specifiers

Private, Protected, and Public Members

In most OOP languages, private, protected, and public members have a specific scope:

  • Private = Used by the defining class only. Invisible outside of the class except by friendly classes.
  • Protected = Used by the defining class and descendant classes only (plus friendly classes).
  • Public = Visible wherever its class can be referenced.

More Info

Definition:  Inheritance

Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1204A1
Enter key:
Code Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #101392 Counter
11845
Since 10/23/2008
-
   Contact Us!
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com


Go ahead!   Use Us! Call: 916-726-5675 


©1995-2019 Prestwood IT Solutions.   [Security & Privacy]