Skip to content

Instantly share code, notes, and snippets.

@yuizho
Last active November 21, 2015 16:12
Show Gist options
  • Save yuizho/d1d66d9153b47cf6858d to your computer and use it in GitHub Desktop.
Save yuizho/d1d66d9153b47cf6858d to your computer and use it in GitHub Desktop.
public interface BrewingMethod {
public String brew();
}
public class CoffeeShop {
public String brewCoffee() {
Siphone siphone = new Siphone();
return siphone.brew() + "が出来上がりました [_]P";
}
}
public class CoffeeShopApp {
public static void main(String... args) {
CoffeeShop coffeeShop = new CoffeeShopApp();
coffeeShop.brewCoffee();
}
}
public class Drip implements BrewingMethod {
@Override
public String brew() {
return "ドリップ式コーヒー";
}
}
public class Siphon implements BrewingMethod {
@Override
public String brew() {
return "サイフォンでいれたコーヒー";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment