• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Bear Bibeault
  • paul wheaton
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Mikalai Zaikin
  • Piet Souris
Bartenders:

inner class visibility

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public class Outside {
2
3 private int a;
4
5 public void foo(int b) {
6 int c = a;
7 int d = b;
11 }
8 class Inside {
9 public Inside() {
10 // What can I see here?
12 }
13 Inside e = new Inside();
14 }
15
16 }
Question Which variable is visible at line 10 above?
Choice 1
a
Choice 2
b
Choice 3
c
Choice 4
d
Choice 5
e
 
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


No one will help you answer that question.

If you dont make an effort.. we wont either.

/Svend Rost
 
Marshal
Posts: 78438
374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Posted by Svend Rost

No one will help you answer that question.

Agree. The correct answer is of course, "f."



You will have to put something like "System.out.println(a)" in line 10 and keep trying until it compiles. And also see what happens if you actually run it.
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic