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

14 查阅

[单项选择题] 已知有下列类的说明,则下列哪个语句是正确的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都不是静态成员,所以不能用类名. 成员方式访问。

计算机考试