网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
( 难度:中等)给出如下代码片段,运行结果为( ):
String a = “ABCD”;
String b = a.toLowerCase();
b.replace(‘a’, ‘d’);
b.replace(‘b’, ‘c’);
System.out.println;
A.abcd
B.ABCD
C.dccd
D.dcba
String a = “ABCD”;
String b = a.toLowerCase();
b.replace(‘a’, ‘d’);
b.replace(‘b’, ‘c’);
System.out.println;
A.abcd
B.ABCD
C.dccd
D.dcba
参考答案
更多 “( 难度:中等)给出如下代码片段,运行结果为( ):String a = “ABCD”; String b = a.toLowerCase();b.replace(‘a’, ‘d’); b.replace(‘b’, ‘c’);System.out.println;A.abcdB.ABCDC.dccdD.dcba” 相关考题
考题
下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i,String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String[]args){ print(99,"Int first"); } }A.String:String first,int:11B.int:11,String:Int firstC.String:String first,int99D.int:99,String:Int first
考题
下面程序的输出结果为( )。 public class Test { public static void main (String args[]) { String X="ABCD"; String Y="EFG"; X=X.substring (X.length()-Y.length()); System.out.println(X); } }A.ABCB.BCDC.EFGD.ABCDEFG
考题
Stringa=ABCD”;Stringb=a.toLowerCase();b.replace(‘a’,‘d’);b.replace(‘b’,‘c’);System.out.println(b);Whatistheresult?()
A.abcdB.ABCDC.dccdD.dcbaE.Compilationfails.F.Anexceptionisthrownatruntime.
考题
阅读下面代码 public class Test { String s="One World One Dream"; public static void main(String[] args) { System.out.println(s); } } 其运行的结果是A.argsB.World One DreamC.sD.编译时出错
考题
下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i, String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String [] args){ print(99,"Int first"); } }A.String:Stringfirst,int:11B.int:11,String:Int firstC.String:String first,int:99D.int:99,String:int first
考题
下面程序代码运行结果为( )。 import java.awt.*; public class Test { public static void main (String args[]) { String s1="a+b+c"; String s2="+"; int i=s1.lastIndexOf (s2); System.out.println(i); } }A.0B.1C.2D.3
考题
有如下代码段 public class OperatorAndExceptions { public static void main(String args[ ] { int i=10,j=15; System.out.println(i==j); String s1 = new String("how are you!"); String s2=new String("how are you!"); System.out.println(s1==s2); } } 其输出为( )。A.true falseB.true trueC.false trueD.false false
考题
有如下代码段 public class OperatorAndExceptions { public static void main(String args[]) { int i=10,j=15; System.out.println(i==j); String s1=new String("how are you!"); String s2=new String("how are you!"); System.out.println(s1==s2); } } 其输出为( )。A.true falseB.true trueC.false trueD.false false
考题
执行以下代码,输出结果的结果是? () public class Test{ public String[] ss = new String[5]; public static void main(String[] args){ System.out.println(ss[1]); } } A、 nullB、 -1C、 编译时出错D、 运行时报错
考题
现有: class Pencil { public void write (String content){ System.out.println ("Write"+content); } } class RubberPencil extends Pencil{ public void write (String content){ System.out.println ("Rubber Write"+content); } public void erase (String content){ System.out.println ("Erase "+content); } } 执行下列代码的结果是哪项?() Pencil pen=new RubberPencil(); pen.write("Hello"); A、 Write HelloB、 Rubber Write HelloC、编译错误D、运行时抛出异常
考题
String a = “ABCD”; String b = a.toLowerCase(); b.replace(‘a’, ‘d’); b.replace(‘b’, ‘c’); System.out.println(b); What is the result? () A、 abcdB、 ABCDC、 dccdD、 dcbaE、 Compilation fails.F、 An exception is thrown at runtime.
考题
预测以下代码片段的输出结果:() var str ; alert(typeof str);A、. string ;B、. undefined;C、. object ;D、. String;
考题
现有: class A {public String name="a"} class B extends A {public String name="b"} 执行如下代码后的结果是哪项?() A a=new B(); System.out.println(a.name); A、 aB、 bC、编译失败D、运行时抛出异常
考题
单选题现有: class A {public String name="a"} class B extends A {public String name="b"} 执行如下代码后的结果是哪项?() A a=new B(); System.out.println(a.name);A
aB
bC
编译失败D
运行时抛出异常
考题
单选题String a = “ABCD”; String b = a.toLowerCase(); b.replace(‘a’, ‘d’); b.replace(‘b’, ‘c’); System.out.println(b); What is the result? ()A
abcdB
ABCDC
dccdD
dcbaE
Compilation fails.F
An exception is thrown at runtime.
考题
单选题String a = “ABCD”; String b = a.toLowerCase(); b.replace(‘a’, ‘d’); b.replace(‘b’, ‘c’); System.out.println(b); What is the result? ()A
abcdB
ABCDC
dccdD
dcbaE
Compilation fails.F
An exception is thrown at runtime.
考题
单选题现有: class A {public String name="a"} class B extends A {public String name="b"} 执行如下代码后的结果是哪项?() A a=new B(); System.out.println(a.name);A
aB
bC
编译失败D
运行时抛出异常
考题
单选题现有: class A {public String name="a"} class B extends A {public String name="b"} 执行如下代码后的结果是哪项?() A a=new B(); System.out.println(a.name);A
aB
bC
编译失败D
运行时抛出异常
考题
单选题执行以下代码,输出结果的结果是? () public class Test{ public String[] ss = new String[5]; public static void main(String[] args){ System.out.println(ss[1]); } }A
nullB
-1C
编译时出错D
运行时报错
考题
单选题执行以下代码,输出结果的结果是? () public class Test{ public String[] ss = new String[5]; public static void main(String[] args){ System.out.println(ss[1]); } }A
nullB
-1C
编译时出错D
运行时报错
考题
单选题String a = “ABCD”; String b = a.toLowerCase(); b.replace(‘a’, ‘d’); b.replace(‘b’, ‘c’); System.out.println(b); What is the result? ()A
abcdB
ABCDC
dccdD
dcbaE
Compilation fails.F
An exception is thrown at runtime.
热门标签
最新试卷