单项选择题
import java.util.*;
class ScanStuff {
public static void main(String [] args) {
String s = "x,yy,123";
Scanner sc = new Scanner(s);
while (sc.hasNext())
System.out.print(sc.next() + " ");
}
}
结果是什么?()
A.x yy
B.x,yy
C.x yy 123
D.x,yy,123
点击查看答案&解析
相关考题
-
单项选择题
BufferedWriter对象中的newLine()方法的含义是哪项?()
A.产生换行
B.插入一个空行
C.产生回车
D.以上都不对 -
单项选择题
输出流输出数据后,应调用哪个方法将其关闭?()
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
