设有定义:String s=“World”;,下列语句错误的是()。
第1题:
下面是一个类的定义,试将程序补充完整。
class A{
String s;
____int a=66;
A(String sl){
s=sl;
}
static int geta(){
return a;
}
}
第2题:
阅读下列代码 public class Test{ String s="One World One Dream"; public static void main(String args[]){ System. out. println(s); } } 其运行结果是
A.args
B.One World One Dream
C.s
D.编译时出错
第3题:
设有定义: char *c; ,以下选项中能够使字符型指针 c 正确指向一个字符串的是
A ) char str[ ]= "string";c=str;
B ) scanf("%s",c);
C ) c=getchar();
D ) *c="string";
第4题:
下列的哪个程序段可能导致错误? ( )
A.String s="hello"; String t="good"; String k=s+t;
B.String s="hello"; String t; t=s[3]+"one";
C.String s="hello"; String standard=s.toUpperCase();
D.String s="hello"; String t=s+"good";
第5题:
下列Applet程序中,指定s为字符串类型,将s绘制在屏幕上,请将程序补充完整。
import java.applet.Applet;
import java.awt.Craphics;
public class testl8_1 extends Applet {
______String s;
public void init ()
{
s=new String("Hello World");
}
public Void______(Graphics g) {
g.______(s,10,25);
}
}
第6题:
假设有以下代码: String s="hello"; String t="hello"; char c[ ]={'h','e','l','l','o'}; 下列选项中,返回false的语句是______。
A.s.equals(t);
B.t.equals(c);
C.s==t;
D.t.equals(new String("hello"));
第7题:
设有如下的用户定义类型: Type Student number As String name As string age As Integer End Type 则以下正确引用该类型成员的代码是______。
A. Student name="李明”
B.Dim s As Student s.name="李明"
C.Dim s As Type Student s.name="李明"
D.Dim s As Type s.name="李明"
第8题:
设有定义:char*c;,以下选项中能够使字符型指针c正确指向一个字符串的是( )
A)char str[]="string";c=str;
B)scanf("%s",c);
C)c=getchar;
D)char str[]="string";strcpy("c,str")
第9题:
阅读下面代码 public class Test { String s="One World One Dream"; public static void main(String[] args) { System.out.println(s); } } 其运行的结果是
A.args
B.World One Dream
C.s
D.编译时出错
第10题:
下列哪个程序段可能导致错误?
A.String s="hello"; String t= "good"; String k=s+ t;
B.String s="hello"; String t; t=s[3]+"one";
C.String s="hello"; String standard=s. toUpperCase
D.String s="hello"; String t =s+ "good"