多项选择题
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?()
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< x.length; i++ ) System.out.println(x[i]);
点击查看答案&解析
相关考题
-
多项选择题
11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12?()
A. final
B. static
C. native
D. public
E. private
F. abstract
G. protected -
单项选择题
Given the following code: 1) class Parent { 2) private String name; 3) public Parent(){} 4) } 5) public class Child extends Parent { 6) private String department; 7) public Child() {} 8) public String getValue(){ return name; } 9) public static void main(String arg[]) { 10) Parent p = new Parent(); 11) } 12) } Which line will cause error?()
A. line 3
B. line 6
C. line 7
D. line 8
E. line 10 -
单项选择题
AButtonispositionedinaFrame.OnlyheightoftheButtonisaffectedbytheFramewhilethewidthisnot.Whichlayoutmanagershouldbeused?()
A. FlowLayout
B. CardLayout
C. North and South of BorderLayout
D. East and West of BorderLayout
E. GridLayout
