Thread safety by Synchronized keyword | Sample program to understand | Java interview question