Thursday, November 13, 2008

prog

1 Given

11. public interface Status {

12. /* insert code here */ int MY_VALUE = 10;

13. }

Which three are valid on line 12? (Choose three.)

A. final

B. static

C. native

D. public

E. private

F. abstract

G. protected

Answer: ABD

2. Given:

10. public class Bar {

11. static void foo( int... x ) {

12. // insert code here

13. }

14. }

Which two code fragments, inserted independently at line 12, will allow the class to compile? (Choose two.)

A. foreach( x ) System.out.println(z);

B. for( int z : x ) System.out.println(z);

C. while( x.hasNext() ) System.out.println( x.next() );

D. for( int i=0; i<>

Answer: BD

No comments: