# Adapter Pattern Ek interface ko doosre mein convert karna — incompatible classes ko saath kaam karana. ## Example — Old aur New payment system ```java // New interface jo hum chahte hain interface ModernPayment { void processPayment(double amount, String currency); } // Old system jo hum change nahi kar sakte class LegacyPaymentSystem { void makePayment(int amountInPaise) { System.out.println("Legacy payment: " + amountInPaise + " paise"); } } // Adapter — LegacyPaymentSystem ko ModernPayment interface mein wrap karta hai class PaymentAdapter implements ModernPayment { private LegacyPaymentSystem legacySystem; PaymentAdapter(LegacyPaymentSystem legacySystem) { this.legacySystem = legacySystem; } @Override public void processPayment(double amount, String currency) { // Convert rupees to paise int amountInPaise = (int)(amount * 100); legacySystem.makePayment(amountInPaise); } } // Use ModernPayment payment = new PaymentAdapter(new LegacyPaymentSystem()); payment.processPayment(250.50, "INR"); ``` ## Real-world Examples - `Arrays.asList()` — array ko List mein adapt - `InputStreamReader` — InputStream ko Reader mein adapt - Spring's `HandlerAdapter`