问题
填空题
下面是一个类的定义,试将程序补充完整。 classA { String s; 【12】 int a=66; A(Strings 1) { s=s1; } static int geta(){ return a; } }
答案
参考答案:static
解析: 本题考查Java中的修饰符。static方法只能处理static成员,非static方法不能处理static成员。所以题目中的geta()方法声明是static的,所以其中的变量必须也声明为static属性。