单选题现有: 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 yyB x,yy,123C x yy 123D x,yyE编译失败F运行的时候有异常抛出
单选题
现有: 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,123
C
x yy 123
D
x,yy
E
编译失败
F
运行的时候有异常抛出
参考解析
解析:
暂无解析
相关考题:
在jsp页面中导入java.util包,使用下列哪个标记() A、%@import=”java.util.*”%B、%@import=”java.util.*”@%C、%@pageimport=”java.util.*”%D、%@pagejava=”java.util.*”%
下列Java源程序结构中前三种语句的次序,正确的是A.import, package, public classB.import必为首,其他不限C.public class, import, packageD.package, import, public class
将下面Applet程序补充完整。import java.awt.*:import java.apptet.*;public class Hi ______ {public void paint(Graghics g) {g.drawstring("Hi!",2.5,2.5);}}
下列Applet程序中,指定s为字符串类型,将s绘制在屏幕上,请将程序补充完整。import java.applet.Applet;import java.awt.Craphics;public class testl8_1 extends Applet {______String s;public void init (){s=new String("Hello World");}public Void______(Graphics g) {g.______(s,10,25);}}
下列Application程序中,指定as为字符串数组类型,先创建一个HashSet对象并赋值,然后在屏幕输出s,请将程序补充完整。import java.util.*;public class test17_1{public static void main(String[] args){__________s=new HashSet();s.add("Hello");s.add("World");s.add(new Character('我'));s.add(new Integer(23));s.add("Hello");__________as={"W","o","r","1","d"};s.add(as);s.add(null);s.add(new Integer(23));s.add(null);System.out.println(__________);
有如下applet代码:import java.applet.*;import java.awt.*;public class MyApplet extends Applet{AA s;public void int(){s = new AA("Hello!", "I love JAVA.");}public void paint(Graphics g){g.drawString(s.toString(), 30, 50);}}class AA{String s1;String s2;AA(String str1, String str2){s1 = str1;s2 - str2;}public String toString(){return s1 + s2;}}运行后,窗口上将会出现什么,选择一个正确答案______。A.Hello!B.I love JAVA.C.Hello! I love JAVA.D.什么都没有
下列哪个选项的java源文件代码片段是不正确的?A.package testpackage; public class Test{ }B.import java. io. *; package testpaekage; public class Test { }C.import java.io.*; class Person { } public class Test { }D.import java.io.*; import java. awt.*; public class Test{ }
从对象流中读取对象,请在下面横线处填写代码完成此程序。import java.util. *;import java. io. *;public class UnSerializeDate{date d = null;UnSerializeDate ( ){try{FileInputStream f1 = new FileInputStream("date.ser");d = (Date) s. readobject ();f1,close();}catch (Exceptin e){e. printStackTrace ();}}public static main(String args [] ){System.out.println("The date read is: "+ a.d.toString());}}
下列哪个选项的java源文件程序段是不正确的? ( )A.package testpackage; public class Test{ }B.import java.io.*; package testpackage; public class Test{ }C.import java.i.*; class Person{} public class Test{ }D.import java.io.*; import java.awt.*; public class Test { }
import java.util.*; public class LetterASort { public static void main(String[] args) { ArrayList strings = new ArrayList(); strings.add(‟aAaA”); strings.add(”AaA”); strings.add(‟aAa”); strings.add(”AAaa”); Collections.sort(strings); for (String s: strings) { System.out.print(s + “ “); } } } What is the result?() A、 Compilation fails.B、 aAaA aAa AAaa AaAC、 AAaa AaA aAa aAaAD、 AaA AAaa aAaA aAaE、 aAa AaA aAaA AAaaF、 An exception is thrown at runtime.
import java.util.*; public class PQ { public static void main(String[] args) { PriorityQueue pq = new PriorityQueue(); pq.add(”carrot”); pq.add(”apple”); pq.add(”banana”); System.out.println(pq.poll() +”:” + pq.peek()); } } What is the result?() A、 apple:appleB、 carrot:appleC、 apple:bananaD、 banana:appleE、 carrot:carrotF、 carrot:banana
Which two allow the class Thing to be instantiated using new Thing()?A、 public class Thing { }B、 public class Thing { public Thing() {} }C、 public class Thing { public Thing(void) {} }D、 public class Thing { public Thing(String s) {} }E、 public class Thing { public void Thing() {} public Thing(String s) {} }
与page指令%@ page import= “java.util.*, java.text.* “ % 等价的是()。A、%@ import="“java.util.*" page=""%@ import="“java.text.*" page=""%@ import="“java.text.*" page=""%@ import="“java.util.*" page=""%@ import="“java.text.*" page=""%@ import="“java.util.*" page=""%@ page import= “java.util.* % %@ page import= “java.text.* “ % B、%@ page import= “java.util.*” , import= “java.text.* “ % C、%@ page import= “java.util.* “ ; % %@ page import= “java.text.* “ ; %D、%@ page import= “java.util.* ; java.text.* “ %
现有: import java.util.*; class AddStuff2 { public static void main(String [] args) { TreeSett=new TreeSet(); if (t.add("one")) if (t.add("two")) if (t.add ("three")) add("four"); for (String s : t) System.out.print (s); } } 结果为:() A、 oneB、 one three twoC、 one two threeD、 one two three fourE、 four one three twoF、编译失败
现有: 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 yyB、 x,yy,123C、 x yy 123D、 x,yyE、编译失败F、运行的时候有异常抛出
Given a class Repetition: 1.package utils; 2. 3.public class Repetition{ 4.public static String twice(Strings){returns+s;} 5.} and given another class Demo: 1.//insert code here2. 3.public class Demo{ 4.public static void main(String[]args){ 5.System.out.println(twice("pizza")); 6.} 7.} Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?()A、import utils.*;B、static import utils.*;C、importutils.Repetition.*;D、static importutils.Repetition.*;E、import utils.Repetition.twice();F、import static utils.Repetition.twice;G、static import utils.Repetition.twice;
定义类: package utils; public class Rep{ public static String twice (String s){return s+s ;} } 再定义另一个类Demo: //insert code here public class Demo{ public static void main (String[] args){ System. out .println( twice( "Hello")); } } 在第一行插入哪项代码,可以使程序正常编译和执行?() A、import utils.*;B、 import utils.Rep.*;C、 import static utils.Rep.twice;D、 static import utils.Rep.twice;
import java.util.*; public class WrappedString { private String s; public WrappedString(String s) { this.s = s; } public static void main(String[] args) { HashSet hs = new HashSet(); WrappedString ws1 = new WrappedString(”aardvark”); WrappedString ws2 = new WrappedString(”aardvark”); String s1 = new String(”aardvark”); String s2 = new String(”aardvark”); hs.add(ws1); hs.add(ws2); hs.add(s1); hs.add(s2); System.out.println(hs.size()); } } What is the result?() A、 0B、 1C、 2D、 3E、 4F、 Compilation fails.G、 An exception is thrown at runtime.
单选题import java.util.*; public class WrappedString { private String s; public WrappedString(String s) { this.s = s; } public static void main(String[] args) { HashSet hs = new HashSet(); WrappedString ws1 = new WrappedString(”aardvark”); WrappedString ws2 = new WrappedString(”aardvark”); String s1 = new String(”aardvark”); String s2 = new String(”aardvark”); hs.add(ws1); hs.add(ws2); hs.add(s1); hs.add(s2); System.out.println(hs.size()); } } What is the result?()A 0B 1C 2D 3E 4F Compilation fails.G An exception is thrown at runtime.
单选题import java.util.*; public class PQ { public static void main(String[] args) { PriorityQueue pq = new PriorityQueue(); pq.add(”carrot”); pq.add(”apple”); pq.add(”banana”); System.out.println(pq.poll() +”:” + pq.peek()); } } What is the result?()A apple:appleB carrot:appleC apple:bananaD banana:appleE carrot:carrotF carrot:banana
单选题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() + " "); } } 结果是什么?()Ax yyBx,yyCx yy 123Dx,yy,123
多选题Which two allow the class Thing to be instantiated using new Thing()?Apublic class Thing { }Bpublic class Thing { public Thing() {} }Cpublic class Thing { public Thing(void) {} }Dpublic class Thing { public Thing(String s) {} }Epublic class Thing { public void Thing() {} public Thing(String s) {} }
单选题与page指令 等价的是()。A%@ import="“java.util.*" page=""%@ import="“java.text.*" page=""%@ import="“java.text.*" page=""%@ import="“java.util.*" page=""%@ import="“java.text.*" page=""%@ import="“java.util.*" page=""%@ page import= “java.util.* % %@ page import= “java.text.* “ % B%@ page import= “java.util.*” , import= “java.text.* “ % C%@ page import= “java.util.* “ ; % %@ page import= “java.text.* “ ; %D%@ page import= “java.util.* ; java.text.* “ %
单选题import java.util.*; public class LetterASort { public static void main(String[] args) { ArrayList strings = new ArrayList(); strings.add(‟aAaA”); strings.add(”AaA”); strings.add(‟aAa”); strings.add(”AAaa”); Collections.sort(strings); for (String s: strings) { System.out.print(s + “ “); } } } What is the result?()A Compilation fails.B aAaA aAa AAaa AaAC AAaa AaA aAa aAaAD AaA AAaa aAaA aAaE aAa AaA aAaA AAaaF An exception is thrown at runtime.
单选题定义类: package utils; public class Rep{ public static String twice (String s){return s+s ;} } 再定义另一个类Demo: //insert code here public class Demo{ public static void main (String[] args){ System. out .println( twice( "Hello")); } } 在第一行插入哪项代码,可以使程序正常编译和执行?()Aimport utils.*;B import utils.Rep.*;C import static utils.Rep.twice;D static import utils.Rep.twice;
单选题现有: import java.util.*; class AddStuff2 { public static void main(String [] args) { TreeSett=new TreeSet(); if (t.add("one")) if (t.add("two")) if (t.add ("three")) add("four"); for (String s : t) System.out.print (s); } } 结果为:()A oneB one three twoC one two threeD one two three fourE four one three twoF编译失败
单选题Given a class Repetition: 1. package utils; 2. 3. public class Repetition { 4. public static String twice(String s) { return s + s; } 5. } and given another class Demo: 1. // insert code here 2. 3. public class Demo { 4. public static void main(String[] args) { 5. System.out.println(twice(”pizza”)); 6. } 7. } Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?()A import utils.*;B static import utils.*;C import utils.Repetition.*;D static import utils.Repetition. *;E import utils.Repetition.twice();F import static utils.Repetition.twice;G static import utils.Repetition.twice;
单选题现有: 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 yyB x,yy,123C x yy 123D x,yyE编译失败F运行的时候有异常抛出