Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ISP Problem
public class I_InterfaceSegregationProblem {
public interface Car {
void charge();
void openDoor();
}
public static class Fiesta implements Car {
@Override
public void charge() {
throw new UnsupportedOperationException("I'm not an electric car");
}
@Override
public void openDoor() {
//abrir a porta
}
}
public static class FocusElectric implements Car {
@Override
public void charge() {
//recarregar
}
@Override
public void openDoor() {
//abrir porta
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment