Results 1 to 4 of 4
  1. #1
    JUser is offline Member
    Join Date
    Sep 2010
    Posts
    5
    Rep Power
    0

    Question A scope too wide?

    Consider the following text:

    Q. "Make the scope of your variables always as narrow as possible,
    otherwise conflicts exist in threads; all methods have access to the attribute of the class."

    What is the problem with this? What's wrong with having an attribute whose scope is too wide?
    Concurrency problems?
    Can someone please give me a concrete example in which this problem is explained?

    Thank you.

    Regards,

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    You may wish to show the fruits of your effort in this and your other questions first and for several reasons: it shows us what you do and don't understand, and we'll also know that these questions are not simply homework or interview dumps.

    Much luck.

  3. #3
    JUser is offline Member
    Join Date
    Sep 2010
    Posts
    5
    Rep Power
    0

    Default

    I'm not a native English speaker. What do you mean by 'show the fruits of your effort'?

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,774
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by JUser View Post
    I'm not a native English speaker. What do you mean by 'show the fruits of your effort'?
    What are your thoughts about the original question. (hint: what if a member variable is static instead of an instance variable?)

    kind regards,

    Jos

Similar Threads

  1. ArrayList going out of scope
    By meustace in forum New To Java
    Replies: 2
    Last Post: 05-20-2010, 02:14 AM
  2. Scope Problem???
    By c_walker in forum New To Java
    Replies: 4
    Last Post: 12-12-2009, 03:30 AM
  3. Variable Scope
    By Laura Warren in forum New To Java
    Replies: 3
    Last Post: 01-11-2009, 11:16 PM
  4. return out of scope?
    By another_steve in forum New To Java
    Replies: 5
    Last Post: 01-28-2008, 10:34 PM
  5. Replies: 1
    Last Post: 06-07-2007, 06:06 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
  •