单项选择题

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.


您可能感兴趣的试卷

你可能感兴趣的试题

2.单项选择题Which will declare a method that forces a subclass to implement it? () 

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){}

3.单项选择题

public class foo {  
public static void main (Stringargs) { 
String s;  
system.out.printIn (“s=” + s);  
}  
}  
What is the result?()

A. The code compiles and “s=” is printed.
B. The code compiles and “s=null” is printed.
C. The code does not compile because string s is not initialized.
D. The code does not compile because string s cannot be referenced.
E. The code compiles, but a NullPointerException is thrown when toString is called.

4.单项选择题下列代码的执行结果是()
int index = 1;
int foo[] = new int [3];
int bar = foo [index]
int baz = bar + index;

A.整型变量 baz 的值为 0

B.整型变量baz 的值为 1

C.整型变量 baz 的值为 2

D.执行错误


5.单项选择题

public class test(  
public static void main(stringargs){  
string foo = args [1];  
string foo = args ;  
string foo = args ;  
}  
)  
And command line invocation:  Java Test red green blue  What is the result? () 

A. Baz has the value of “”
B. Baz has the value of null
C. Baz has the value of “red”
D. Baz has the value of “blue”
E. Bax has the value of “green”
F. The program throws an exception.

6.单项选择题

int index = 1;  
boolean test = new Boolean;  
boolean foo= test [index]; 
What is the result?()

A. Foo has the value of 0.
B. Foo has the value of null.
C. Foo has the value of true.
D. Foo has the value of false.
E. An exception is thrown.
F. The code will not compile.

7.多项选择题Which three are valid declarations of a float? () 

A. Float foo = -1;
B. Float foo = 1.0;
C. Float foo = 42e1;
D. Float foo = 2.02f;
E. Float foo = 3.03d;
F. Float foo = 0x0123;

8.多项选择题Which two statements are reserved words in Java? ()

A. Run
B. Import
C. Default
D. Implement

10.单项选择题

interface foo {  
int k = 0;  
}   
public class test implements Foo ( 
 public static void main(String args) (  
 int i;  
Test test = new test (); 
 i= test.k;  
i= Test.k;  
i= Foo.k;  
)  
)  
What is the result? ()

A. Compilation succeeds.
B. An error at line 2 causes compilation to fail.
C. An error at line 9 causes compilation to fail.
D. An error at line 10 causes compilation to fail.
E. An error at line 11 causes compilation to fail.