单选题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
abcd
B
ABCD
C
dccd
D
dcba
E
Compilation fails.
F
An exception is thrown at runtime.
参考解析
解析:
暂无解析
相关考题:
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 TestString 1 { public static void main(String[] args) { String str = “420”; str += 42; System.out.print(str); } } What is the output?()A、 42B、 420C、 462D、 42042E、 Compilation fails.F、 An exception is thrown at runtime.
public static void main(String[]args){ for(inti=0;i=10;i++){ if(i6)break; } System.out.println(i); } What is the result?()A、6B、7C、10D、11E、Compilation fails.F、Anexception is thrown at runtime.
11. String test= “a1b2c3”; 12. String[] tokens = test.split(”//d”); 13. for(String s: tokens) System.out.print(s +“ “); What is the result?() A、 a b cB、 1 2 3C、 a1b2c3D、 a1 b2 c3E、 Compilation fails.F、 The code runs with no output.G、 An exception is thrown at runtime.
public static void main(String[] args) { String str = “null‟; if (str == null) { System.out.println(”null”); } else (str.length() == 0) { System.out.println(”zero”); } else { System.out.println(”some”); } } What is the result?()A、 nullB、 zeroC、 someD、 Compilation fails.E、 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.
public static void main(String[] args) { for (int i=0;i= 10;i++){ if( i6) break; } System.out.println(i); } What is the result?() A、 6B、 7C、 10D、 11E、 Compilation fails.F、 An exception is thrown at runtime.
class TestA { public void start() { System.out.println(”TestA”); } } public class TestB extends TestA { public void start() { System.out.println(”TestB”); } public static void main(String[] args) { ((TestA)new TestB()).start(); } } What is the result?() A、 TestAB、 TestBC、 Compilation fails.D、 An exception is thrown at runtime.
public class Test { public static void main(String[] args) { String str = NULL; System.out.println(str); } } What is the result?() A、 NULLB、 Compilation fails.C、 The code runs with no output.D、 An exception is thrown at runtime.
public class Test { public static void main( String[] args) { String foo = args[1]; String bar = args[2]; String baz = args[3]; System.out.println(“baz = “ + baz); } } And the command line invocation: java Test red green blue What is the result?() A、 baz =B、 baz = nullC、 baz = blueD、 Compilation fails.E、 An exception is thrown at runtime.
public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( “Finally” ); } } } What is the result?()A、 FinallyB、 Compilation fails.C、 The code runs with no output.D、 An exception is thrown at runtime.
11. String test = “This is a test”; 12. String[] tokens = test.split(”/s”); 13. System.out.println(tokens.length); What is the result?() A、 0B、 1C、 4D、 Compilation fails.E、 An exception is thrown at runtime.
interface Beta {} class Alpha implements Beta { String testIt() { return “Tested”; } } public class Main1 { static Beta getIt() { return new Alpha(); } public static void main( String[] args ) { Beta b = getIt(); System.out.println( b.testIt() ); } } What is the result?() A、 TestedB、 Compilation fails.C、 The code runs with no output.D、 An exception is thrown at runtime.
String a = null; a.concat(“abc”); a.concat(“def”); System.out.println(a); What is the result?() A、 abcB、 nullC、 abcdefD、 Compilation fails.E、 The code runs with no output.F、 An exception is thrown at runtime.
单选题public class TestString 1 { public static void main(String[] args) { String str = “420”; str += 42; System.out.print(str); } } What is the output?()A 42B 420C 462D 42042E Compilation fails.F An exception is thrown at runtime.
单选题String a = null; a.concat(“abc”); a.concat(“def”); System.out.println(a); What is the result?()A abcB nullC abcdefD Compilation fails.E The code runs with no output.F An exception is thrown at runtime.
单选题public class Test { public static void main( String[] args) { String foo = args[1]; String bar = args[2]; String baz = args[3]; System.out.println(“baz = “ + baz); } } And the command line invocation: java Test red green blue What is the result?()A baz =B baz = nullC baz = blueD Compilation fails.E 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 TestA { public void start() { System.out.println(”TestA”); } } public class TestB extends TestA { public void start() { System.out.println(”TestB”); } public static void main(String[] args) { ((TestA)new TestB()).start(); } } What is the result?()A TestAB TestBC Compilation fails.D An exception is thrown at runtime.
单选题public static void main(String[] args) { String str = “null‟; if (str == null) { System.out.println(”null”); } else (str.length() == 0) { System.out.println(”zero”); } else { System.out.println(”some”); } } What is the result?()A nullB zeroC someD Compilation fails.E An exception is thrown at runtime.
单选题public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( “Finally” ); } } } What is the result?()A FinallyB Compilation fails.C The code runs with no output.D An exception is thrown at runtime.
单选题public static void main(String[] args) { for (int i=0;i6) break; } System.out.println(i); } What is the result?()A 6B 7C 10D 11E Compilation fails.F An exception is thrown at runtime.
单选题Given: What is the result?()A Afoo AfooB Afoo BfooC Bfoo AfooD Bfoo BfooE Compilation fails.F An exception is thrown at runtime.
单选题11. String test = “This is a test”; 12. String[] tokens = test.split(”/s”); 13. System.out.println(tokens.length); What is the result?()A 0B 1C 4D Compilation fails.E An exception is thrown at runtime.
单选题public class Test { public static void main(String[] args) { String str = NULL; System.out.println(str); } } What is the result?()A NULLB Compilation fails.C The code runs with no output.D An exception is thrown at runtime.
单选题11. String test= “a1b2c3”; 12. String[] tokens = test.split(”//d”); 13. for(String s: tokens) System.out.print(s +“ “); What is the result?()A a b cB 1 2 3C a1b2c3D a1 b2 c3E Compilation fails.F The code runs with no output.G An exception is thrown at runtime.
单选题What is the result?()A 1B 12C 14D 123E 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;A.abcdB.ABCDC.dccdD.dcba