java校园招聘面试问题及答案,JAVA面试题目

频道:最新招聘 日期: 浏览:131

一、抽象策略角色java校园招聘面试问题及答案:

public interface SuperCash {
public double acceptCash();
}
二、具体策略角色:
   a..策略角色1(普通时间)
  public class NormalCash implements SuperCash{
@Override
public double acceptCash() {
return 0.2;
}
}
 b.策略角色2(5-8点)
  public class MorningCash implements SuperCash{
@Override
public double acceptCash() {
return 0.4;
}
}
      c.策略角色3(7-9点)

public class ForenoonCash implements SuperCash{
@Override
public double acceptCash() {
return 0.3;
}
}
三、环境角色

public class CashContext {
SuperCash superCash = null;
public CashContext(int time) {
if(time>=5&&time=7&&time