Interview practice question
Shared formatter gives wrong dates
Backend Engineering · Concurrency · Beginner
Your Java service shares one SimpleDateFormat instance across threads, and dates are occasionally garbled. Why?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- SimpleDateFormat is not thread-safe.
- Internal mutable state corrupted.
- Use DateTimeFormatter (immutable).
- Or one instance per thread/call.
- Check library thread-safety docs.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.