Question: Consider the following class:

```
public class MyClass
{
    private MyObject obj;

    public MyClass()
    {
        obj = new MyObject();
    }

    public void methodCalledByOtherThreads()
    {
        obj.doStuff();
    }
}

```

Since obj was created on one thread and accessed from another, could obj be null when methodCalledByOtherThread is called? If so, would declaring obj as volatile be the best way to fix this issue? Would declaring obj as final make any difference?

Edit:
For clarity, I think my main question is:
Can other threads see that obj has been initialized by some main thread or could obj be stale (null)?

Answer: 
It depends on whether the reference is published "unsafely". A reference is "published" by being written to a shared variable; another thread reads the variable to get the reference. If there is no relationship of `happens-before(write, read)`, the publication is called unsafe. An example of unsafe publication is through a non-volatile static field.

@chrylis 's interpretation of "unsafe publication" is not accurate. Leaking `this` before constructor exit is orthogonal to the concept of unsafe publication. 

Through unsafe publication, another thread may observe the object in an uncertain state (hence the name); in your case, field `obj` may appear to be null to another thread. Unless, `obj` is `final`, then it cannot appear to be null even if the host object is published unsafely.

This is all too technical and it requires further readings to understand. The good news is, you don't need to master "unsafe publication", because it is a discouraged practice anyway. The best practice is simply: never do unsafe publication; *i.e.* never do data race; *i.e.* always read/write shared data through proper synchronization, by using `synchronized, volatile` or `java.util.concurrent`.

If we always avoid unsafe publication, do we still *need* `final` fields? The answer is no. Then why are some objects (e.g. `String`) designed to be "thread safe immutable" by using final fields? Because it's assumed that they can be used in malicious code that tries to create uncertain state through deliberate unsafe publication. I think this is an overblown concern. It doesn't make much sense in server environments - if an application embeds malicious code, the server is compromised, period. It probably makes a bit of sense in Applet environment where JVM runs untrusted codes from unknown sources - even then, this is an improbable attack vector; there's no precedence of this kind of attack; there are a lot of other more easily exploitable security holes, apparently.
This class (if taken as is) is NOT thread safe. In two words: there is reordering of instructions in java ([Instruction reordering & happens-before relationship in java](https://stackoverflow.com/questions/16213443/instruction-reordering-happens-before-relationship-in-java)) and when in your code you're instantiating MyClass, under some circumstances you may get following set of instructions:

* Allocate memory for new instance of MyClass;
* Return link to this block of memory;
* Link to this not fully initialized MyClass is available for other threads, they can call "methodCalledByOtherThreads()" and get NullPointerException;
* Initialize internals of MyClass.

In order to prevent this and make your MyClass really thread safe - you either have to add "final" or "volatile" to the "obj" field. In this case Java's memory model (starting from Java 5 on) will guarantee that during initialization of MyClass, reference to alocated for it block of memory will be returned only when all internals are initialized.

For more details I would strictly recommend you to read nice book "Java Concurrency in Practice". Exactly your case is described on the pages 50-51 (section 3.5.1). I would even say - you just can write correct multithreaded code without reading that book! :)