欢迎来到计算机考试题库网 计算机题库官网
logo
全部科目 > java工程师信产部认证考试

单项选择题

在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;但还可以有其他的代码

点击查看答案&解析

相关考题

微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题