相关考题
-
单项选择题
输出流输出数据后,应调用哪个方法将其关闭?()
A.stop()
B.flush()
C.exit()
D.close() -
单项选择题
1. import java.util.*; 2. class AddStuff { 3. public static void main(String [] args) { 4. TreeSet〈String〉 s = new TreeSet〈String〉(); 5. s.add("one"); 6. s.add("two"); 7. // insert code here 8. for(String s2 : sorted) 9. System.out.print(s2 + " "); 10. } 11. } 和四个代码片段: s1. SortedSet sorted = s.tailSet(s.first()); s2. SortedSet〈String〉 sorted = s.tailSet(s.first()); s3. SortedSet sorted = (SortedSet)s.tailSet(s.first()); s4. SortedSet sorted = (SortedSet〈String〉)s.tailSet(s.first()); 分别插入到第7行,哪项可以编译?()
A.s1
B.s2
C.s2 和 s3
D.s2 和 s4 -
单项选择题
class Bird { static void talk() { System.out.print("chirp "); } } class Parrot extends Bird { static void talk() { System.out.print("hello "); } public static void main(String [] args) { Bird [] birds = {new Bird(), new Parrot()}; for( Bird b : birds) b.talk(); } } 结果为:()
A.chirp chirp
B.chirp hello
C.hello hello
D.编译失败
