网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
String a = null; a.concat(“abc”); a.concat(“def”); System.out.println(a); What is the result?()
- A、 abc
- B、 null
- C、 abcdef
- D、 Compilation fails.
- E、 The code runs with no output.
- 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.” 相关考题
考题
以下各选项中能正确声明一个表示50个值为null的字符串数组的是( )。A.string [] a;B.string a[];C.ehar a[50][];D.string a[]=new String[50];
考题
String[] elements={for,tea,too};String first=(elements.length0)?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].
考题
定义一个表示10个值为null的字符串数组,下面选项正确的是( )。A.String []a;B.String a[];C.char a[l0][];D.String a[]=new String[10];
考题
定义一个表示10个值为null的字符串数组,下面选项正确的是A.String [] a;B.String a[];C.char a[10][];D.String a[]=new String[10];
考题
定义String s=null,会出现异常的选项是()。Ⅰ:if((s!=null)(s.length()>0))Ⅱ:if((s!=null)(s.length()>0)) Ⅱ:if((s!=null)(s.length()>0)) Ⅲ:if(s==null)|(s.length()==0)) Ⅳ:if(s==null)||(s.length()==0))A.Ⅱ、ⅢB.Ⅱ、Ⅲ、ⅣC.Ⅰ、ⅢD.Ⅲ、Ⅳ
考题
已知String类定义如下:class String{public:String(const char *str = NULL); // 通用构造函数String(const String another); // 拷贝构造函数~ String(); // 析构函数String perater =(const String rhs); // 赋值函数private:char *m_data; // 用于保存字符串};尝试写出类的成员函数实现。
考题
已知类 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 个函数
考题
定义一个表示100个值为null的字符串数组,正确的选项是______。A.String[ ]a;B.String a[ ];C.char a[100][ ];D.String a[ ]=new String[100]
考题
以下( )表达式是不合法的。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].
考题
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 Employee{ private String name; public Employee(String name){ this.name = name; } public void display(){ System.out.print(name); } } public class Manager extends Employee{ private String department; public Manager(String name,String department){ super(name); this.department = department; } public void display(){ System.out.println(super.display()+”,”+department); } } 执行语句new Manager(“smith”,”SALES”)后程序的输出是哪项?() A、 smith,SALESB、 null,SALESC、 smith,nullD、 null,nullE、 编译错误
考题
下面哪个是对字符串String的正确定义()。A、String s1=null;B、String s2=’null’;C、String s3=(String)‘abc’;D、String s4=(String)‘/uface’;
考题
下面哪些语句能够正确地生成5个空字符串?()A、String a[]=new String[5];for(int i=0;i5;a[i++]=“”);B、String a[]={“”,“”,“”,“”,“”};C、String a[5];D、String[5]a;E、String[]a=new String[5];for(int i=0;i5;a[i++]=null);
考题
public class Employee{ private String name; public Employee(String name){ this.name = name; } public void display(){ System.out.print(name); } } public class Manager extends Employee{ private String department; public Manager(String name,String department){ super(name); this.department = department; } public void display(){ System.out.println( super.display()+”,”+department); } } 执行语句new Manager(“smith”,”SALES”)后程序的输出是哪项?() A、 smith,SALESB、 null,SALESC、 smith,nullD、 null,null
考题
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.
考题
You are consuming a Windows Communication Foundation (WCF) service in an ASP. NET Web application.The service interface is defined as follows:[ServiceContract]public interface ICatalog{ [OperationContract] [WebGet(UriTemplate="/Catalog/Items/{id}", ResponseFormat=WebMessageFormat.Json)] string RetrieveItemDescription(int id); } The service is hosted at Catalogsvc.You need to call the service using jQuery to retrieve the description of an item as indicated by a variable named itemId. Which code segment should you use?()A、$get(String.format("/Catalogsvc/Catalog/Items/id{0}", itemId) null, function (data) { ... }, javascript");B、$get(String.format("/Catalogsvc/Catalog/Items/{0}", itemId), null, function (data) { ... }, "json");C、$get(String.format("/Catalogsvc/Catalog/Items/{0}", itemld), null, function (data) { ... }, "xml");D、$get(String.format("/Catalogsvc/Catalog/Items/id{0}", itemld), null, function (data) { ... }, "json");
考题
单选题String[] elements={"for","tea","too"}; String first=(elements.length0)?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].
考题
单选题Given: 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].
考题
单选题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.
考题
单选题public class Employee{ private String name; public Employee(String name){ this.name = name; } public void display(){ System.out.print(name); } } public class Manager extends Employee{ private String department; public Manager(String name,String department){ super(name); this.department = department; } public void display(){ System.out.println( super.display()+”,”+department); } } 执行语句new Manager(“smith”,”SALES”)后程序的输出是哪项?()A
smith,SALESB
null,SALESC
smith,nullD
null,null
考题
单选题下面哪个是对字符串String的正确定义()。A
String s1=null;B
String s2=’null’;C
String s3=(String)‘abc’;D
String s4=(String)‘/uface’;
热门标签
最新试卷