Question: I have a simple button, and I want to use CSS to make it onhover, bring up a dropdown of a few more buttons with links, and when the button is pressed I want the button to stay at the onhover state. How can this be accomplished? For example a games button that when hovered over it drops down to buttons that have different links to games. Sorry if this is unclear. Thanks in advanced.

Answer: 
When you make those two synchronized, the getter and setter themselves are thread-safe. More specifically:

- When you call the setter, you are guaranteed that the value of the variable is what you set it to when the method finishes.
- When you call the getter, you are guaranteed that the return value is the value of the variable when you made the call.

However, making the getter and setter *themselves* thread-safe does not mean that the application *as a whole* (i.e. whatever is using this class) is thread-safe. If your thread wants to call a setter then get the same value upon invoking the getter, that involves synchronization on a different level. 

As far as thread-safety is concerned, a thread-safe class need not control **how** its methods are invoked (for example, it need not control which way the threads interleave their calls), but it needs to ensure that **when** they are, the methods do what they are supposed to.
`synchronized` in Java is an object-wide lock. Only one `synchronized` method of any given object can be executed on any given thread at a time. Let's have this class:

```
class Foo
{
    private int bar;

    public synchronized void SetBar() { ... }
    public synchronized int GetBar() { ... }
}

```

* Thread 1 calls `SetBar()`. Thread 1 acquires the object lock.
* Thread 2 wants to call `SetBar()`, but Thread 1 holds the lock. Thread 2 is now queued to acquire the lock when Thread 1 will release it.
* Thread 1 finishes executing `SetBar()` and releases the lock.
* Thread 2 immediately acquires the lock and starts executing `SetBar()`.
* Thread 1 calls `GetBar()`. Thread 1 is now queued to acquire the lock when Thread 2 will release it.
* Thread 2 finishes executing `SetBar()` and releases the lock.
* Thread 1 acquires the lock, executes `GetBar()`, and is done with it.

You did the work twice, but you didn't cause any race condition. It may or may not be erroneous to do the work twice, depending on what it is.

A frequent pattern is to have one thread produce content and one other thread do something useful with it. This is called the producer-consumer pattern. In this case, there is no confusion over who or what tries to `SetBar()` and what tries to `GetBar()`.