• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Examulator doubt on inner classes

 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchers,

I know, Marcus Green has an own discussion group about his questions.
But today Christie Thom posted here

that she passed the exam.
Congratulations!


And further:

Actually I am surprised that I got lot of questions from inner classes I can't remember exactly but almost 10 questions.


So I post this inner class question here.
In the question of today (question #99)
http://www.examulator.com/phezam/question.php

about method local inner classes the question was:

Which of the following statements are true of a method local inner class?



the correct answer given was

1) It has access to all members of its enclosing class
2) It can only access final variables of its enclosing method


I think that answer 1 is false. If the method (where the inner class is in) is static, the inner class has no access to non-static members of the enclosing class. So we can't say it has access to all members.

Any comments // on that?



Yours,
Bu.
 
arch rival
Posts: 2813
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you post some code that illustrates this?
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure, here's an example


The error is the classic one: "Cannot make a static reference ...".

Yours,
Bu.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic