网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
11. public static void test(String str) { 12. if(str == null | str.lellgth() == 0) { 13. System.out.println(”String is empty”); 14. } else { 15. System.out.println(”String is not empty”); 16. } 17. } And the invocation: 31. test(llull); What is the result?()
A
Au exception is thrown at runtime.
B
“String is empty” is printed to output.
C
Compilation fails because of au error in line 12.
D
“String is not empty” is printed to output.
参考答案
参考解析
解析:
暂无解析
更多 “单选题11. public static void test(String str) { 12. if(str == null | str.lellgth() == 0) { 13. System.out.println(”String is empty”); 14. } else { 15. System.out.println(”String is not empty”); 16. } 17. } And the invocation: 31. test(llull); What is the result?()A Au exception is thrown at runtime.B “String is empty” is printed to output.C Compilation fails because of au error in line 12.D “String is not empty” is printed to output.” 相关考题
考题
下列程序的作用是在屏幕上显示一个200×200大小的窗口,在横线上填入相应的语句。import java.awt.*;public class Test extends Frame. {public static void main (String args[]) {Test t=new Test ("Hello");t.setSize (200,200);t.setBackground (Color.re@D)@;【 】;}public Test (String str) {super(str);}}
考题
阅读下面程序public class ConcatTest{P ublic static void main(String[] args){S tring str1 = " abc " ;S tring str2 = " ABC " ;S tring str3 = str1.concat(str2);S ystem.out.println(str3);}}程序的运行结果是A)abcB)ABCC)abcABCD)ABCabc
考题
指出下列程序运行的结果public class Example{ String str=newString("good"); char[]ch={'a','b','c'}; public static voidmain(String args[]){ Example ex=new Example();ex.change(ex.str,ex.ch); System.out.print(ex.str+" and ");Sytem.out.print(ex.ch); } public void change(String str,charch[]){ str="test ok"; ch[0]='g'; } } ( )AA good and abcBgood and gbcCtest ok and abcDtest ok and gbc
考题
下面代码的运行结果是( )。 public class ConcatTest { public static void main (String[ ] args) { String str1 = "abc"; String str2 = "ABC"; String str3 = str1. coneat(str2); System. out. println(str3); } }A.abcB.ABCC.abcABCD.ABCabc
考题
阅读下面程序 public class ConcatTest{ public static void main(String[] args) { String strl = "abc"; String str2 = "ABC"; String str3 = str1.concat(str2); System.out.println(str3); } } 程序的运行结果是:A.abeB.ABCC.abcABCD.ABCabc
考题
void setmemory(char **p, int num){ *p=(char *) malloc(num);}void test(void){ char *str=NULL;getmemory(str,100);strcpy(str,"hello");printf(str);}运行test函数有什么结果?( )
考题
4 . 写出程序的输出结果class Class1 {private string str = "Class1.str";private int i = 0;static void StringConvert(string str) {str = "string being converted.";}static void StringConvert(Class1 c) {c.str = "string being converted.";}static void Add(int i) {i++;}static void AddWithRef(ref int i) {i++;}static void Main() {int i1 = 10;int i2 = 20;string str = "str";Class1 c = new Class1();Add(i1);AddWithRef(ref i2);Add(c.i);StringConvert(str);StringConvert(c);Console.WriteLine(i1);Console.WriteLine(i2);Console.WriteLine(c.i);Console.WriteLine(str);Console.WriteLine(c.str);}}
考题
void GetMemory(char *p){p = (char *)malloc(100);}void Test(void) {char *str= NULL;GetMemory(str); strcpy(str, "hello world");printf(str);}请问运行 Test 函数会有什么样的结果?
考题
char *GetMemory(void){ char p[] = "hello world";returnp; }void Test(void){char *str = NULL;str = GetMemory(); printf(str);}请问运行 Test 函数会有什么样的结果?
考题
void Test(void){char *str = (char *)malloc(100); strcpy(str, “hello”); free(str); if(str != NULL) { strcpy(str, “world”); printf(str);}}请问运行 Test 函数会有什么样的结果?
考题
说出下面几个函数的区别:private void test(string str){…}private void test(ref string str){…}private void test(out string str){…}如果一个页面与数据
考题
指出下列程序运行的结果 ( ) public class Example{ String str=new String("good"); char[]ch={'a','b','c'}; public static void main(String args[]){ Example ex=new Example(); ex.change(ex.otr,ex.ch); System.out.print(ex.str+"and"); System.out.print(ex.ch); } public void change(String str,char ch[])} str="test ok"; ch[0]≈'g'; } }A.good and abcB.good and gbcC.test ok and abcD.test ok and gbc
考题
下列程序通过实现Runnable接口创建一个线程,选择正确的语句填入程序的横线处。 class MyRun implements Runnable { String str; MyRun(String s) { str = s; } public void run() System.out.println(str); } } public class ex40 { public static void main(String[] args) { String name = "实现阶段Runnable 接口"; MyRun my = new MyRun(name); Thread th = th. start ( ); } }A.new MyRun(my)B.new Thread()C.new Thread(my)D.Thread(my)
考题
下列程序运行的结果为:public class Example{String str=new String("good");char[] ch={'a','b','c'};public static void main(String args[]){Example ex=new Example();ex.change(ex.str,ex.ch);System.out.print(ex.str+" and ");Sytem.out.print(ex.ch);}public void change(String str,char ch[]){str="test ok";ch[0]='g';}}A. good and abcB. good and gbcC. test ok and abcD. test ok and gbc
考题
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 parse(String str) { try { float f= Float.parseFloat(str); } catch (NumberFormatException nfe) { f= 0; } finally { System.out.println(f); } } public static void main(String[] args) { parse(”invalid”); } What is the result?() A、 0.0B、 Compilation fails.C、 A ParseException is thrown by the parse method at runtime.D、 A NumberFormatException is thrown by the parse method 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.
考题
11. public void testIfA() { 12. if(testIfB(”True”)) { 13. System.out.println(”True”); 14. } else { 15. System.out.println(”Not true”); 16. } 17. } 18. public Boolean testIfB(String str) { 19. return Boolean.valueOf(str); 20. } What is the result when method testIfA is invoked?() A、 TrueB、 Not trueC、 An exception is thrown at runtime.D、 Compilation fails because of an error at line 12.E、 Compilation fails because of an error at line 19.
考题
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 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、Compilationfails.E、Anexceptionisthrownatruntime.
考题
public static void test(String str) { int check = 4; if (check = str.length()) { System.out.print(str.charAt(check -= 1) +“, “); } else { System.out.print(str.charAt(0) + “, “); } } and the invocation: test(”four”); test(”tee”); test(”to”); What is the result?() A、 r, t, t,B、 r, e, o,C、 Compilation fails.D、 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.
考题
单选题public static void test(String str) { int check = 4; if (check = str.length()) { System.out.print(str.charAt(check -= 1) +“, “); } else { System.out.print(str.charAt(0) + “, “); } } and the invocation: test(”four”); test(”tee”); test(”to”); What is the result?()A
r, t, t,B
r, e, o,C
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 static void parse(String str) { try { float f= Float.parseFloat(str); } catch (NumberFormatException nfe) { f= 0; } finally { System.out.println(f); } } public static void main(String[] args) { parse(”invalid”); } What is the result?()A
0.0B
Compilation fails.C
A ParseException is thrown by the parse method at runtime.D
A NumberFormatException is thrown by the parse method 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 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
Compilationfails.E
Anexceptionisthrownatruntime.
热门标签
最新试卷