单项选择题

1. interface foo { 
2. int k = 0; 
3. }
4.   
5. public class test implements Foo ( 
6. public static void main(String args[]) ( 
7. int i; 
8. Test test = new test (); 
9. i= test.k; 
10.i= Test.k; 
11.i= Foo.k; 
12.) 
13.) 
14.       
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.


您可能感兴趣的试卷

你可能感兴趣的试题

2.单项选择题

package foo;
public class Outer ( 
public static class Inner ( 
) 
)  
Which statement is true? () 

A. An instance of the Inner class can be constructed with “new Outer.Inner ()”
B. An instance of the inner class cannot be constructed outside of package foo.
C. An instance of the inner class can only be constructed from within the outer class.
D. From within the package bar, an instance of the inner class can be constructed with “new inner()”

3.多项选择题Which two demonstrate an “is a” relationship?()   

A. public interface Person { }  public class Employee extends Person { }
B. public interface Shape { }  public class Employee extends Shape { }
C. public interface Color { }  public class Employee extends Color { }
D. public class Species { }  public class Animal (private Species species;)
E. interface Component { }  Class Container implements Component ( Private Component[ ] children;  )

4.多项选择题

public class MethodOver  { 
public void setVar (int a, int b, float c)  { 
} 
}  
Which two overload the setVar method?()  

A. Private void setVar (int a, float c, int b)  { }
B. Protected void setVar (int a, int b, float c) { }
C. Public int setVar (int a, float c, int b) (return a;)
D. Public int setVar (int a, int b, float c) (return a;)
E. Protected float setVar (int a, int b, float c) (return c;)

5.多项选择题

public class ConstOver { 
public ConstOver (int x, int y, int z)  { 
} 
}  
Which two overload the ConstOver constructor?()   

A. ConstOver ( ) { }
B. Protected int ConstOver ( ) { }
C. Private ConstOver (int z, int y, byte x) { }
D. Public Object ConstOver (int x, int y, int z) { }
E. Public void ConstOver (byte x, byte y, byte z) { }

10.多项选择题

Integer i = new Integer (42); 
Long 1 = new Long (42); 
Double d = new Double (42.0);  
Which two expressions evaluate to True?()

A. (i ==1)
B. (i == d)
C. (d == 1)
D. (i.equals (d))
E. (d.equals (i))
F. (i.equals (42)