万能百科  > 计算机   > 

[填空题] 下面是一个类的定义,试将程序补充完整。 class Test String s; 【12】 int a =66;Test(String s1)

2021-07-20   

[填空题] 下面是一个类的定义,试将程序补充完整。

class Test

String s;

【12】 int a =66;

Test(String s1)

s=s1;

static int geta( )

return a;

正确答案:

static

参考解析:

本题考查Java中的修饰符。static方法只能处理static成员,非static方法不能处理 static成员。题目中的geta()方法声明是static的,所以其中的变量也必须声明为static属性。

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

标签