举一反三
- 下列哪个语句将双精度值d转换为字符串s? A: s = (new Double(d)).toString(); B: s = (Double.valueOf(s)).toString(); C: s = new Double(d).stringOf(); D: s = String.stringOf(d);
- 下列声明常量的语句中,正确的是( ) A: double PI=3.1415926; B: const double PI=3.1415926; C: static double PI=3.1415926; D: static const double PI=3.1415926;
- 在C#中,下列常量定义正确的是 A: define PI 3.1415926 B: Const double PI=3.1415926 C: Const double PI 3.1415926 D: define double PI=3.1415926
- 阅读程序,下面的哪个选项是正确的?( )。 class ExSuper{ String name; String nick_name; public ExSuper(String s,String t) { name = s; nick_name = t; } public String toString(){ return name; } } public class Example extends ExSuper{ public Example(String s,String t){ super(s,t); } public String toString(){ return name +"a.k.a"+nick_name; } public static void main(String args[]){ ExSuper a = new ExSuper(“First”,“1st”); ExSuper b = new Example(“Second”,“2nd”); System.out.println(“a is”+a.toString()); System.out.println("b is"+b.toString()); } }
- 在C#中,下列常量定义正确的是【 】 A: const double PI 3.1415926 B: const double Pi=2.7 C: define double PI 3.1415926 D: define double e=2.7
内容
- 0
在C#中,以下常量定义正确的是 ( )。 A: A.const double PI 3.1415926; B: B.const double e=2.7; C: C.define double PI 3.1415926; D: D.define double e=2.7;
- 1
String s=”127”将s转换为int的代码:int i= ,将s转换为double的代码:double d= 。
- 2
以下函数中,不是Object类所有的是() A: notify B: valueOf C: toString D: wait
- 3
Java语言中所有类都包含的成员是( )。 A: toString() B: compareTo() C: length() D: valueOf()
- 4
读代码:public class foo {static String s;public static void main (String[]args) {System.out.println (“s=” + s);}}结果是: A: The code compiles, but a NullPointerException is thrown when toString is called B: The code compiles and “s=null” is printed C: The code does not compile because string s cannot be referenced D: The code does not compile because string s is not initialized E: The code compiles and “s=” is printed