Does changing a volatile field update the object?

Viewed 180

I have the following class

public class Guardian {
    volatile String response;
    private Future future;
    private Long time;
}

If response was to be modified by thread A, then would thread B see the new value of response via:

Guardian guardian = requestManager.getGuardian();
String response = guardian.getResponse();
5 Answers
Related