Problem Statement
When do you prefer Comparable over Comparator, and why?
Explanation
Use Comparable when a class has a natural, single ordering—like String or BigDecimal—and you control the source to implement compareTo. Prefer Comparator when you need multiple orderings (e.g., by name, then by date) or you can’t modify the class. Comparator keeps sorting logic separate and flexible.