Results 1 to 2 of 2
  1. #1
    ggyyree is offline Member
    Join Date
    Nov 2010
    Posts
    15
    Rep Power
    0

    Question Inner class name conflict problem

    Hi there,

    I have a question about the inner class name conflict. Suppose we got:

    Java Code:
    class A {
        
        private boolean fuzzy;
        
        class B {
          
            private boolean fuzzy;
    
    
          // Which fuzzy it returns?
          public boolean isFuzzy() {
            return fuzzy;
          }
    
          // I know this one will return outer class's fuzzy
         public boolean isAFuzzy() {
            return A.this.fuzzy;
          }
    
       }
    }
    Which fuzzy it returns in the first isFuzzy() method? Thanks.


    Aaron

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    786
    Rep Power
    5

    Default

    initialize one with true, the other one with false and run the code and you will see :)

Similar Threads

  1. Replies: 9
    Last Post: 12-15-2010, 02:38 AM
  2. Name Conflict
    By vanhuh21 in forum New To Java
    Replies: 7
    Last Post: 08-09-2010, 11:45 AM
  3. jdk jre tomcat conflict
    By simo_mon in forum Java Servlet
    Replies: 7
    Last Post: 09-29-2009, 08:44 AM
  4. Replies: 6
    Last Post: 04-08-2009, 04:05 AM
  5. Replies: 8
    Last Post: 03-21-2009, 09:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •