试题详情
单项选择题 在J2EE中,对于简单属性的方法: public Color getColor(){…} 和public Void setColor(Color c){…} 假定color是类中的属性,在方法体内可以() 

A、  在getColor方法体内只能有一行代码:return color; 在setColor方法体内只能有一行代码: this.color=c;

B、  在getColor方法体内只能有一行代码:return color; 在setColor方法体内一定有该行代码: this.color=c;但还可以有其他的代码

C、  在getColor方法体内一定有该行代码:return color; 但还可以有其他的代码, 在setColor方法体内只能有该行代码: this.color=c;

D、  在getColor方法体内一定要有该行代码:return color; 但还可以有其他的代码,在setColor方法体内一定有该行代码: this.color=c;但还可以有其他的代码

  • D
  • 关注下方微信公众号,在线模考后查看

热门试题