当前位置:IT认证>软件水平

问题:[选择题]

[单项选择题] 已知有下列类的说明,则下列哪个语句是正确的public class Test{ private float f = 1.0f; int m = 12; static int n=1; public static void main(String arg[ ]){Test t = new Test( ); }}


A.t.f;
B.this.n;
C.Test.m;
D.Test.f;

参考答案: A

  参考解析

此题主要考查对象的正确使用,其格式为对象名.调用的方法名或变量名。在static方法中,不能使用this。变量m和f都不是静态成员,所以不能用类名.成员方式访问。

微信端