问题 单项选择题

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

单项选择题
解答题