File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Inner Class & HAS-a class 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 "Inner Class & HAS-a class" Watch "Inner Class & HAS-a class" New topic

Inner Class & HAS-a class

chintan ramavat
Ranch Hand

Joined: Sep 15, 2006
Posts: 134
Hello ranchers !

I have quick question,

inner class = has-a class = delegation of task

class A class B {
{ || private C c;
void check () { || void add () {
|| c.add();
Inner i = new Inner(); } }

just wanted to make sure that is that the same thing..
i know access modifiers along like static n outer does not have access to any of inner members but the reverse is true ..and all

thanks in advance

chintan ramavat
Ranch Hand

Joined: Sep 15, 2006
Posts: 134
sorry it's just kinda mix..

class A {

void test () {

Inner i = new Inner(); // it's the same thing of delegation or
i.check(); adding more power to class

class B {

private C c ;

void add () {

c.sum(); //here it's just delegation of function to other

just want to make sure it's the same thing or is there any other underlying features among them

-- sorry for the above
-- thanks in advance

I agree. Here's the link:
subject: Inner Class & HAS-a class
It's not a secret anymore!