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

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

toString()的作用是()。

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

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

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

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


参考答案和解析
将任意类型的数据转换为字符串类型
更多 “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.返回线程的字符串信息

考题 classSuper{publicIntegergetLenght(){returnnewInteger(4);}}publicclassSubextendsSuper{publicLongGetLenght(){returnnewLong(5);}publicstaticvoidmain(String[]args){Supersooper=newSuper();Subsub=newSub();System.out.println(sooper.getLenght().toString()+,”+sub.getLenght().toString());}}Whatistheoutput?()A.4,4B.4,5C.5,4D.5,5E.Compilationfails.

考题 阅读以下函数说明和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);}}

考题 "在Flash MX 中,未定义的toString 是" ( ) A. 〃〃B. undefinedC. NULLD. null

考题 以下( )不是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、返回线程的名称

考题 class A {   public String toString () {   return “4”;   }   }   class B extends A {   8. public String toString () {   return super.toString() + “3”;   }   }   public class Test {   public static void main(Stringargs) {   System.out.printIn(new B());   }   }   What is the result?()  A、 Compilation succeeds and 4 is printed.B、 Compilation succeeds and 43 is printed.C、 An error on line 9 causes compilation to fail.D、 An error on line 14 causes compilation to fail.E、 Compilation succeeds but an exception is thrown at line 9.

考题 Object类中的()方法不能被覆写。A、toString()B、getClass()C、clone()D、finalize()

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

考题 基肥的主要作用是(),因此,常用()肥料作基肥。

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

考题 柴油机连杆的作用是作复杂的()运动。

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

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

考题 You are creating a Web Form. You write the following code segment to create a SqlCommand object.Dim conn As SqlConnection = New SqlConnection(connString)conn.Open( )Dim cmd As SqlCommand = conn.CreateCommand( )cmd.CommandText = "select count(*) from Customers"You need to display the number of customers in the Customers table. Which two code segments can you use to achieve this goal?()A、Dim customerCount As Object = cmd.ExecuteScalar()lblCompanyName.Text = customerCount.ToString()B、Dim customerCount As Integer = cmd.ExecuteNonQuery()lblCompanyName.Text = customerCount.ToString()C、Dim dr As SqlDataReader = cmd.ExecuteReader()dr.Read()lblCompanyName.Text = dr(0).ToString()D、Dim dr As SqlDataReader = cmd.ExecuteReader()dr.Read()lblCompanyName.Text = dr.ToString()

考题 创建Range用的是哪个方法:()A、cloneRange();B、document.createRange();C、deleteContents();D、toString();

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

考题 单选题class A {   public String toString () {   return “4”;   }   }   class B extends A {   8. public String toString () {   return super.toString() + “3”;   }   }   public class Test {   public static void main(Stringargs) {   System.out.printIn(new B());   }   }   What is the result?()A  Compilation succeeds and 4 is printed.B  Compilation succeeds and 43 is printed.C  An error on line 9 causes compilation to fail.D  An error on line 14 causes compilation to fail.E  Compilation succeeds but an exception is thrown at line 9.

考题 判断题String s = (Double.valueOf("3.1415926")).toString()。A 对B 错