About Question enthuware.ocpjp.v7.2.1385 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
ThufirHawat
Posts: 28
Joined: Wed Feb 25, 2015 9:03 am
Contact:

About Question enthuware.ocpjp.v7.2.1385 :

Post by ThufirHawat »

I don't understand :
"More than one inner instance can be associated with the same outer instance."

Can we have an example or something?

Online
admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1385 :

Post by admin »

Code: Select all

public class TestClass{
  class Inner{
  }
  public static void main(String args[]) {
    TestClass tc = new TestClass();
    Inner i1 = tc.new Inner(); 
    Inner i2 = tc.new Inner(); 

  }
    
}

fariz.siracli
Posts: 22
Joined: Mon Jul 06, 2015 11:45 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1385 :

Post by fariz.siracli »

" Member variables of the outer instance can always be referred to using only the variable name within the inner instance. "

very difficult sentence. could you explain it, please?

Online
admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1385 :

Post by admin »

Code: Select all

public class TestClass{
   int outer;
  class Inner{
     public void m(){
          System.out.println(outer); //accessing outer with just the name. You can do TestClass.this.outer as well.
      }
  }
    
}

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 8 guests