网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

1、toString()的作用是()。

A.将任意类型的数据转换为字符串类型

B.将任意类型的数据转换为布尔类型

C.将任意类型的数据转换为数字类型

D.将任意类型的数据转换为空值类型


参考答案和解析
将任意类型的数据转换为字符串类型
更多 “1、toString()的作用是()。A.将任意类型的数据转换为字符串类型B.将任意类型的数据转换为布尔类型C.将任意类型的数据转换为数字类型D.将任意类型的数据转换为空值类型” 相关考题
考题 阅读下列Java程序和程序说明,将应填入(n)处的字句写在对应栏内。【说明】下面的程序先构造Point类,再顺序构造Ball类。由于在类Ball中不能直接存取类Point中的xCoordinate及yCoordinate属性值,Ball中的toString方法调用Point类中的toString方法输出中心点的值。在MovingBall类的toString方法中,super.toString调用父类Ball的toString方法输出类Ball中声明的属性值。public class Point{private double xCoordinate;private double yCoordinate;public Point 0 }public Point(ouble x, double y){xCoordinate = x;yCoordinate = y;}public String toString(){return "( + Double.toString(Coordinate)+ ","+ Double.toString(Coordinate) + ");}//other methods}public class Ball{(1); //中心点private double radius; //半径private String colour; ///颜色public Ball() { }public Ball(double xValue, double yValue, double r)// 具有中心点及半径的构造方法{center=(2);//调用类Point 中的构造方法radius = r;}public Ball(double xValue, double yValue, double r, String c)// 具有中心点、半径及颜色的构造方法{(3);//调用3个参数的构造方法colour = c;}public String toString(){return "A ball with center" + center, toString() + ", radius"+ Double.toString(radius) + ", colour" + colour;}//other methods}public class MovingBall. (4){private double speed;public MovingBall() { }public MovingBall(double xValue, double yValue, double r, String e, double s){(5);// 调用父类Ball中具有4个参数的构造方法speed = s;}public String toString( ){ return super, toString( ) + ", speed "+ Double.toString(speed); }//other methods}public class Tester{public static void main(String args[]){MovingBall mb = new MovingBall(10,20,40,"green",25);System.out.println(mb);}}

考题 你正在创建一个Web窗体。你写了如下的代码段去创建一个 SqlCommand对象:现在,你需要显示Customers表中客户的数量。下面那两个代码段能达到此目的?() A. object customerCount = cmd.ExecuteScalar(); lblCompanyName.Text =customerCount.ToString();B. int customerCount = cmd.ExecuteNonQuery(); lblCompanyName.Text =customerCount.ToString();C. SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); lblCompanyName.Text =dr[0].ToString();D. SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); lblCompanyName.Text = dr.ToString();

考题 Thread类的方法中,toString( )方法的作用是( )。A.只返回线程的名称B.返回当前线程所属的线程组的名称C.返回当前线程对象D.返回线程的字符串信息

考题 阅读以下函数说明和Java代码,将应填入(n)处的字句写在对应栏内。【说明】下面的程序先构造Point类,再顺序构造Ball类。由于在类Ball中不能直接存取类Point中的xCoordinate及yCoordinate属性值,Ball中的toString方法调用Point类中的toStrinS方法输出中心点的值。在MovingBsll类的toString方法中,super.toString调用父类Ball的toString方法输出类Ball中声明的属性值。【Java代码】//Point.java文件public class Point{private double xCoordinate;private double yCoordinate;public Point(){}public Point(double x,double y){xCoordinate=x;yCoordinate=y;}public String toStrthg(){return"("+Double.toString(xCoordinate)+","+Double.toString(yCoordinate)+")";}//other methods}//Ball.java文件public class Ball{private (1);//中心点private double radius;//半径private String color;//颜色public Ball(){}public Ball(double xValue, double yValue, double r){//具有中心点及其半径的构造方法center=(2);//调用类Point中的构造方法radius=r;}public Ball(double xValue, double yValue, double r, String c){//具有中心点、半径和颜色的构造方法(3);//调用3个参数的构造方法color=c;}public String toString(){return "A ball with center"+center.toString()+",radius "+Double.toString(radius)+",color"+color;}//other methods}class MovingBall (4) {private double speed;public MovingBall(){}public MoyingBall(double xValue, double yValue, double r, String c, double s){(5);//调用父类Ball中具有4个参数的构造方法speed=s;}public String toString(){return super.toString()+",speed"+Double.toString(speed);}//other methods}public class test{public static void main(String args[]){MovingBall mb=new MovingBall(10,20,40,"green",25);System.out.println(mb);}}

考题 以下( )不是Object类的方法A)clone()B)finalize()C)toString()D)hasNext()

考题 已知sb 为StringBuffer 的一个实例,且sb.toString() 的值为"abcde ",则执行sb. reverse()后,sb.toString()的值为()。

考题 下面这段代码会产生( )个String对象。Strings1="hello";Strings2=s1.substring(2,3);Strings3=s1.toString();Strings4=newStringBuffer(s1).toString();A、1B、2C、3D、4

考题 以下程序能顺利通过编译: public class am_I_right { public static void main(String args[]) { this.toString(); } String toString() { retur。() 此题为判断题(对,错)。

考题 以下语句能顺利通过编译: class test { static void sayHello() { this.toString(); } public String toString() { retur。() 此题为判断题(对,错)。

考题 以下程序能顺利通过编译: class student { String sno,sname; static void output() { this.toString(); } String toString() { retur。() 此题为判断题(对,错)。

考题 闸阀的主要作用是作切断用,不允许作节流用。

考题 toString()方法可把数组转换为字符串,并返回结果。()

考题 Thread类的方法中,toString()方法的作用是()A、只返回线程的名称B、返回当前线程所属的线程组的名称C、返回当前线程对象D、返回线程的名称

考题 用原子吸收光谱法测定钙时,加入1%的钾盐溶液,其作用是()。A、减小背景B、作释放剂C、作消电离剂D、提高火焰温度

考题 已知sb为 StringBuffer 的一个实例,且 sb.toString() 的值为 "abcde ", 则执行sb. reverse(),sb.toString()的值为()

考题 闸阀的主要作用是作()用,不允许作()用。

考题 for(inti=1;i=3;i++){switch(i){case1:Console.write(i.ToString());case2:Console.write((i*2).ToString());case1:Console.write((i*3).ToString());}}上述关于C#代码的描述正确的是()。A、程序将报告编译错误〃提示Case标签不能贯穿到一个标签〃不能运行B、运行时输出149C、运行时输出123246369D、运行时在屏幕上没有输出

考题 将逻辑值赋值给内存变量STRING1的正确方法是()A、STRING1=IRUEB、STORE”T”TOSTRING1C、STORETTOSTRING1D、STRING1=”T”

考题 console.log(1.toString);上面代码输出的结果是()。A、报错B、1C、undefinedD、NULL

考题 下面哪个不是String类的方法?()A、subString()B、startsWith()C、toString()D、toUpperCase()

考题 String s = (Double.valueOf("3.1415926")).toString()。

考题 1. interface TestA { String toString(); }  2. public class Test {  3. public static void main(String[] args) {  4. System.out.println(new TestA() {  5. public String toString() { return “test”; }  6. }  7. }  8. }  What is the result?() A、 testB、 nullC、 An exception is thrown at runtime.D、 Compilation fails because of an error in line 1.E、 Compilation fails because of an error in line 4.F、 Compilation fails because of an error in line 5.

考题 单选题You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application allows users to post comments to a page that can be viewed by other users. You add a SqlDataSource control named SqlDS. You write the following code segment:   01 private void SaveComment()   02 {   03   string ipaddr;   04 ►  05   SqlDS1.InsertParameters["IPAddress"].DefaultValue = ipaddr;   06   ...  07   SqlDS1.Insert();   08 }   You need to ensure that the IP Address of each user who posts a comment is captured alongwith the user’s comment.  Which code segment should you insert at line 04?()A ipaddr = Server[REMOTE_ADDR].ToString(); B ipaddr = Session[REMOTE_ADDR].ToString(); C ipaddr = Application[REMOTE_ADDR].ToString(); D ipaddr = Request.ServerVariables[REMOTE_ADDR].ToString();

考题 单选题console.log(1.toString);上面代码输出的结果是()。A 报错B 1C undefinedD NULL

考题 填空题已知sb为 StringBuffer 的一个实例,且 sb.toString() 的值为 "abcde ", 则执行sb. reverse(),sb.toString()的值为()

考题 单选题下列Razor视图中的编码正确的是()。A (12.5.IsInt()?整数:非整数)B razor.ToString()C {inti=1;@if(i==2){}}D {userName=邓星林;}

考题 单选题将逻辑值赋值给内存变量STRING1的正确方法是()A STRING1=IRUEB STORE”T”TOSTRING1C STORETTOSTRING1D STRING1=”T”

考题 单选题for(inti=1;i=3;i++){switch(i){case1:Console.write(i.ToString());case2:Console.write((i*2).ToString());case1:Console.write((i*3).ToString());}}上述关于C#代码的描述正确的是()。A 程序将报告编译错误〃提示Case标签不能贯穿到一个标签〃不能运行B 运行时输出149C 运行时输出123246369D 运行时在屏幕上没有输出