What is the Strategy pattern in Java, and how does it work?
The Strategy pattern allows an algorithm to be selected at runtime. It defines a family of algorithms and makes them interchangeable by encapsulating each one in a separate class.
That's correct. The Strategy pattern encapsulates different algorithms and allows them to be swapped out dynamically.
Can you show how you would implement a `PaymentStrategy` with different payment methods like `CreditCard` and `PayPal`?