Java认证模考试题(五)
百度广告
A. static
B. final
C. abstract
D. No modifier can be used
Explanation:
Correct Answer: B 29 of 60
Which one of the following is correct to declare a native method?
B. public native void test(){}
C. public void native test();
D. public native test(){}
Explanation:
Correct Answer: A 30 of 60
Given the following definition of a class:
public class Test {
private float f = 1.0;
int m = 12;
static int n=1;
public static void main(String arg) {
Test t = new Test();
// some code...
}
}
Which of the following usage are legal?
B. this.n
C. Test.m
D. Test.n
Explanation:
Correct Answer: A,D 31 of 60
|||
Given the following code:
1) class Example{
2) String str;
3) public Example(){
4) str= example;
5) }
6) public Example(String s){
7) str=s;
8) }
9) }
10) class Demo extends Example{
11) }
12) public class Test{
13) public void f () {
14) Example ex = new Example(Good);
15) Demo d = new Demo(Good);
16) }
Which line will cause an error?
B. line 6
C. line 10
D. line 14
E. line 15
Explanation:
Correct Answer: E 32 of 60
Given the following class definition in one source file:
class Base {
public Base (){ //... }
public Base ( int m ){ //... }
protected void fun( int n ){ //... }
}
public class Child extends Base{
// member methods
}
Which methods can be added into the Child class correctly?
B. void fun ( int n ){ //... }
C. protected void fun ( int n ) { //... }
D. public void fun ( int n ) { //... }
E. public m(){ //... }
Explanation:
Correct Answer: C,D 33 of 60
Which statements are correct?
B. A subclass inherits all methods ( including the constructor ) from the superclass.
C. A class can implement as many interfaces as needed.
D. When a class implements an interface, it can define as many methods of the interface as needed.
Explanation:
Correct Answer: A,C 34 of 60
编辑推荐:
温馨提示:因考试政策、内容不断变化与调整,长理培训网站提供的以上信息仅供参考,如有异议,请考生以权威部门公布的内容为准! (责任编辑:长理培训)
点击加载更多评论>>