设有定义:String s=“World”;,下列语句错误的是()。A、int m=s.indexOf(‘r’);B、char c=s.charAt(0);C、int n=s.length();D、String str=s.append(‘2’);
设有定义:String s=“World”;,下列语句错误的是()。
- A、int m=s.indexOf(‘r’);
- B、char c=s.charAt(0);
- C、int n=s.length();
- D、String str=s.append(‘2’);
相关考题:
设有定义: char *c; ,以下选项中能够使字符型指针 c 正确指向一个字符串的是A ) char str[ ]= "string";c=str;B ) scanf("%s",c);C ) c=getchar();D ) *c="string";
设有定义:char*c;,以下选项中能够使字符型指针c正确指向一个字符串的是( )A)char str[]="string";c=str;B)scanf("%s",c);C)c=getchar;D)char str[]="string";strcpy("c,str")
下面是一个类的定义,试将程序补充完整。class A{String s;____int a=66;A(String sl){s=sl;}static int geta(){return a;}}
假设有以下代码: 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"));
阅读下列代码 public class Test{ String s="One World One Dream"; public static void main(String args[]){ System. out. println(s); } } 其运行结果是A.argsB.One World One DreamC.sD.编译时出错
设有如下的用户定义类型: 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="李明"
下列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);}}
阅读下面代码 public class Test { String s="One World One Dream"; public static void main(String[] args) { System.out.println(s); } } 其运行的结果是A.argsB.World One DreamC.sD.编译时出错
下列的哪个程序段可能导致错误? ( )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";
下列哪个程序段可能导致错误?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. toUpperCaseD.String s="hello"; String t =s+ "good"
设有定义:Strings=“World”;,下列语句错误的是( )。A、intm=s.indexOf(‘r’);B、charc=s.charAt(0);C、intn=s.length();D、Stringstr=s.append(‘2’);
下列选项中,()是正确的表达式。 A、% String s = “hello world ” ;% B、% = “hello world ” ;% C、% = “hello world ” % D、% ! “hello world ” %
下面哪个是对字符串String的正确定义()。A、String s1=null;B、String s2=’null’;C、String s3=(String)‘abc’;D、String s4=(String)‘/uface’;
有语句String s=”hello world”; ,以下操作哪个是不合法的()A、int i=s.length();B、s=3;C、String ts=s.trim();D、String t=s+”!”
public class X { public static void main (String[]args) { string s = new string (“Hello”); modify(s); System.out.printIn(s); } public static void modify (String s) { s += “world!”; } } What is the result?() A、 The program runs and prints “Hello”B、 An error causes compilation to fail.C、 The program runs and prints “Hello world!”D、 The program runs but aborts with an exception.
public class X { public static void main (Stringargs) { string s = new string (“Hello”); modify(s); System.out.printIn(s); } public static void modify (String s) { s += “world!”; } } What is the result?() A、The program runs and prints “Hello”B、An error causes compilation to fail.C、The program runs and prints “Hello world!”D、The program runs but aborts with an exception.
单选题有语句String s=”hello world”; ,以下操作哪个是不合法的()Aint i=s.length();Bs=3;CString ts=s.trim();DString t=s+”!”
单选题public class X { public static void main (Stringargs) { string s = new string (“Hello”); modify(s); System.out.printIn(s); } public static void modify (String s) { s += “world!”; } } What is the result?()AThe program runs and prints “Hello”BAn error causes compilation to fail.CThe program runs and prints “Hello world!”DThe program runs but aborts with an exception.
单选题设有定义:char *c;以下选项中能够使字符型指针c正确指向一个字符串的是( )。Achar str[]=string;c=str;Bscanf(%s,c);Cc=getchar();D*c=string;
单选题设有定义:String s=“World”;,下列语句错误的是()。Aint m=s.indexOf(‘r’);Bchar c=s.charAt(0);Cint n=s.length();DString str=s.append(‘2’);
单选题public class X { public static void main (String[]args) { string s = new string (“Hello”); modify(s); System.out.printIn(s); } public static void modify (String s) { s += “world!”; } } What is the result?()A The program runs and prints “Hello”B An error causes compilation to fail.C The program runs and prints “Hello world!”D The program runs but aborts with an exception.
单选题下列选项中,()是正确的表达式。A% String s = “hello world ” ;% B% = “hello world ” ;% C% = “hello world ” % D% ! “hello world ” %
单选题下面哪个是对字符串String的正确定义()。AString s1=null;BString s2=’null’;CString s3=(String)‘abc’;DString s4=(String)‘/uface’;