Thread able to view modifications within main program?

Posted on 2005-05-05
Last Modified: 2010-03-31

I am implementing an array within the main program and I am implementing a separate thread. Say if the array is passed to the thread as an argument and the array is constantly being modified within the main program. Can the thread still see the modified data of the array at any time? For example,

array declared with values {5,34,6,3} initialized within main program

Thread now started and array passed as an argument to thread

array modifed to be {4,5,6,3,3,5,6}

If the thread accesses the array at this time will the thread be able to see the array with the new values?

Question by:blaze_wk
    LVL 92

    Expert Comment

    LVL 92

    Accepted Solution

    both threads are accessing the same variable

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    If you have upgraded to Java2 update 10 on a Microsoft Windows client, you may have discovered that your Java application does not work as it did before.  For example, the colors of your Java2D graphic may be all wrong for no apparent reason. Aft…
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Video by: Michael
    Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now