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

Extends Superclass

nani aman
Ranch Hand

Joined: Sep 22, 2004
Posts: 33
i have 2 classes, both extends JFrame element. i want the Integrity class to be a subclass to Security class so i can call a data member which in integrity class using package but how i can extend in integrity class as its already have extends JFrame?
can it be twice of extends?

public class Security extends JFrame implements ActionListener{
public class Integrity extends JFrame implements ActionListener{

hopefully somebody help me
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
This will do what you want:

Integrity will inherit all public members of Security and also inherit the public members of JFrame that were not overridden by Security.

A child class will inherit members from its parent, its parent's parent, etc., all the way back to java.lang.Object. You have to consider whether each member is public, protected, or default. private members are never inherited.

Mike Gershman
SCJP 1.4, SCWCD in process
I agree. Here's the link:
subject: Extends Superclass
It's not a secret anymore!