Datasets:
ArXiv:
License:
File size: 584 Bytes
c574d3a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
/**
* Created by Administrator on 2017/7/11.
*/
public abstract class CaffeineBeverage
{
final void prepareRecipe()
{
boilWater();
brew();
pourInCup();
if(customerWantsCondiments())
{
addCondiment();
}
}
boolean customerWantsCondiments()
{
return true;
}
abstract void brew();
abstract void addCondiment();
final void pourInCup()
{
System.out.println("倒进杯子里");
}
final void boilWater()
{
System.out.println("煮开水");
}
}
|