单项选择题
public class test(
public int aMethod()[
static int i=0;
i++;
return I;
)
public static void main (String args[]){
test test = new test();
test.aMethod();
int j = test.aMethod();
System.out.printIn(j);
]
}
What is the result?()
A. Compilation will fail.
B. Compilation will succeed and the program will print “0”
C. Compilation will succeed and the program will print “1”
D. Compilation will succeed and the program will print “2”
相关考题
-
单项选择题
abstract class abstrctIt { abstract float getFloat (); } public class AbstractTest extends AbstractIt { private float f1= 1.0f; private float getFloat () {return f1;} } What is the result?()
A. Compilation is successful.
B. An error on line 6 causes a runtime failure.
C. An error at line 6 causes compilation to fail.
D. An error at line 2 causes compilation to fail. -
单项选择题
Youwantsubclassesinanypackagetohaveaccesstomembersofasuperclass.Whichisthemostrestrictiveaccessmodifierthatwillaccomplishthisobjective?()
A. Public
B. Private
C. Protected
D. Transient
E. No access modifier is qualified. -
单项选择题
Whichwilldeclareamethodthatforcesasubclasstoimplementit?()
A. Public double methoda();
B. Static void methoda (double d1) {}
C. Public native double methoda();
D. Abstract public void methoda();
E. Protected void methoda (double d1){}
