Skip to main content

Explain the Adapter design pattern.

Mid Java
Quick Answer Adapter pattern makes incompatible interfaces work together. Creates a wrapper (adapter) that translates one interface into another. Object adapter: holds a reference to the adaptee, translates calls. Class adapter: extends the adaptee (rare in Java due to single inheritance). Example: java.io.InputStreamReader adapts InputStream (byte stream) to Reader (character stream) interface.

Answer

Converts interface of one class into another expected by client.
Enables integration of incompatible systems.
Useful for legacy code and third-party APIs.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice