aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Regarding Inheritance. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Regarding Inheritance." Watch "Regarding Inheritance." New topic
Author

Regarding Inheritance.

Krish Pinnamaneni
Greenhorn

Joined: Mar 16, 2005
Posts: 22
Hi ,
I am telling my understandings regarding extending or instantiating or referencing class A in package source from class C of package destination.
Please tell any body have better idea regarding this.
Thanks,
Krish .

package source; package source;

public class A { class C { }
static int I =10;
A () {}
}

Q1] what are the conditions to instantiate, extend, refer class A by class C of same package source

A] Extending class A by class C of same package:
constructor of super class must not be private. It could be either default or public or protected.

B] Instantiating class A in class C of same package (i.e. source)
Just you can do it using new operator unless class A constructor is private.

C] Referening Class A in class C of same package (i.e. source)
We can do that if Class A is having public or default static members only.
____________________________________________________________________


package source; package destination;

public class A { class C { }
static int I =10;
A () {}
}


Q2] what are the conditions to instantiate, extend, refer class A in source package from class c of destination package


A] Extending class A in by class C of different package say destination;
Then class A must be public and its constructor must be either protected or public.

B] Instantiating class A in class C of different package say destination (i.e. package destination)
Then class A must be public and its constructor must be public.

C] Referencing class A in class C which is in different package (i.e.destin ation)
Then class must be public and only its public static members are accessible.
amit taneja
Ranch Hand

Joined: Mar 14, 2003
Posts: 810
hii... i don't get what he is saying ...can anybody explain ?


Thanks and Regards, Amit Taneja
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Hi, Krish

I am afraid that, like Amit, I do not understand your question very well. Would you please explain yourself posting a more specific question?


[ May 14, 2005: Message edited by: Edwin Dalorzo ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding Inheritance.