wood burning stoves 2.0*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Extends Superclass" Watch "Extends Superclass" New topic
Author

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: http://aspose.com/file-tools
 
subject: Extends Superclass
 
Similar Threads
i was almost worried
retrieve other class method
JMenuItems
Call superclass from subclass
3 problems with my applet...