String a = null; a.concat(“abc”); a.concat(“def”); System.out.println(a); What is the result?()
已知类 String 的原型为class string{public:string(const char *str=null);//普通构造函数string(const string &other);//拷贝构造函数---string(void);string &operate=(const string &other);//赋值函数private:char * m-data;//用于保存字符串};请编写 string 的上述4 个函数
点击查看答案
C#中,string str = null 与 string str =””,请尽量用文字说明区别。(要点:说明详细的内存空间分配)
7 .string = null 和string = “”的区别
定义一个表示100个值为null的字符串数组,正确的选项是______。A.String[ ]a;B.String a[ ];C.char a[100][ ];D.String a[ ]=new String[100]
在C#中,string str = null 与 string str = “” 请尽量使用文字或图象说明其中的区别。
以下( )表达式是不合法的。A.String x="Sky";int y=5;x + =y:B.String x="Sky":int y=5:if(x==y){}C.String x="Sky":int y=5:x=x+y:D.String x=null:int y=(x!=null) && (x.length( )>0)?x.length:0
String[] elements = { “for”, “tea”, “too” }; String first = (elements.length > 0)? elements[0] null; What is the result?()A、 Compilation fails.B、 An exception is thrown at runtime.C、 The variable first is set to null.D、 The variable first is set to elements[0].