Explain how Java handles concurrent execution using threads, and how thread synchronization works under the hood.