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

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

java中 String str = "hello world"下列语句错误的是()。

  • A、str+=’ a’
  • B、int strlen = str.length
  • C、str=100
  • D、str=str+100

参考答案

更多 “java中 String str = "hello world"下列语句错误的是()。A、str+=’ a’B、int strlen = str.lengthC、str=100D、str=str+100” 相关考题
考题 下列程序段的输出结果是( )。 String MyStr="Hello,"; MyStr=MyStr+ "World!"; System.out.println(MyStr);A.Hello, World!B.Hello,C.World!D.该程序段有语法错误

考题 下列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);}}

考题 请阅读下面的程序classTest/{privatestaticStringname;static/{name="World";System.out.print(name);/}publicstaticvoidmain(String[]args)/{System.out.print("Hello");Testtest=newTest();/}/}下列选项中,程序运行结果是()。:A.WorldB.HelloC.World HelloD.Hello World

考题 设有语句:char str1[]="string",str2[8],*str3,*str4="string";,则下列对库函数strcpy调用不正确的是A.strcpy(str1,"Hello1");B.strcpy(str2,"Hello2");C.strcpy(str3,"Hello3");D.strcpy(str4,"Hell04");

考题 有如下applet代码:import java.applet.*;import java.awt.*;public class MyApplet extends Applet{AA s;public void int(){s = new AA("Hello!", "I love JAVA.");}public void paint(Graphics g){g.drawString(s.toString(), 30, 50);}}class AA{String s1;String s2;AA(String str1, String str2){s1 = str1;s2 - str2;}public String toString(){return s1 + s2;}}运行后,窗口上将会出现什么,选择一个正确答案______。A.Hello!B.I love JAVA.C.Hello! I love JAVA.D.什么都没有

考题 设有以下语句: char str1[]="string",str2[8],*str3,*str4=="string; 则______不是对库函数的正确调用。A.strcpy(str1,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str4,"HELLO4")

考题 设有以下语句: char str1 []="string"mstr2 [8],*str3,*str4=="string"; 则 ______不是对库函数的正确调用。A.strcpy(str1,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str 4,"HELLO4");

考题 以下程序的输出结果是 ______。includeincludevoidmain(){char *p1=",he 以下程序的输出结果是 ______。 #include<iostream.h> #include<string.h> void main(){ char *p1=",hello",*p2="world!",str[50]:"Hii"; strcpy(str+2,p1); strcat(str,p2); cout<<str; }A.Hii,hello world!B.hello world!C.ii,hello world!D.Hi,hello world!

考题 设有以下语句: char strl[]="string",str2[8],*str3,*str4="string"; 则_______不是对库函数的正确调用。A.strcpy(strl,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str4,"HELLO4");

考题 String s = "Hello";s = s + " world!";这两行代码执行后,原始的String 对象中的内容到底变了没有?

考题 设有语句:char str1[]="string", str2[8], *ste3, *str4="string";,则下列不是对库函数 strcpy的正确调用的是______。A.strcpy(str1,"HELLOI");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLOY");D.strcpy(str4,"HELLO4");

考题 下列程序段的输出结果是 String MyStr = "Hello,"; MyStr = MyStr + "World!"; System.out.println(MyStr);A.Hello,World!B.Hello,C.World!D.该程序段有语法错误

考题 void Test(void){char *str = (char *)malloc(100); strcpy(str, “hello”); free(str); if(str != NULL) { strcpy(str, “world”); printf(str);}}请问运行 Test 函数会有什么样的结果?

考题 设有语句:char str1[]="string",str2[8],*str3,*str4="string";,则下列对库函数strcpy调用不正确的是A.strcpy (str1,"Hello1");B.strcpy(str2, "Hello2");C.strcpy(str3, "Hell03");D.strcpy(str4, "Hell04");

考题 若定义cin>>str;当输入Hello World!,所得的结果是str= ______。A.Hello World!B.HelloC.WorldD.Hello World

考题 下面的程序各自独立,请问执行下面的四个TestMemory 函数各有什么样的结果?①void GetMemory(char * p){p = (char * )malloc(100);}void TestMemory (void){char *str = NULL;GetMemory (str);strcpy(str, "hello world");prinff(str);}② char * GetMemory (void){char p[ ] = "hello world";return p;}void TestMemory (void){char * str = NULL;str = GetMemory( );printf(str);}③void GetMemory(char * * p, int num){* p = (char * )malloc(num);}void TestMemory (void){char * str = NULL;GetMemory(str, 100);strcpy( str, "hello" );printf(sir);}④void TestMemory (void){char *str = (char * )malloe(100);strepy (str, "hello" );free ( str );if(str ! = NULL){strepy( str, "world" );printf(str);}}

考题 设char str1[11]="HELLO,",str2[10]=“world”;则执行语句cout 设char str1[11]="HELLO,",str2[10]=“world”;则执行语句 cout<<strlen(strcpy(str1,str2)));后的输出结果是 ______。A.12B.11C.7D.5

考题 设有以下语句: char str1[]="string",str2[8],*str3,*str4="str4="string"; 则______不是对库函数的正确调用。A.strcpy(str1,"HELLO1");B.strcpy(str2."HELLO2");C.strcpy(str3."HELLO3");D.strcpy(str4."HELLO4");

考题 下列选项中,()是正确的表达式。 A、% String s = “hello world ” ;%  B、% = “hello world ” ;% C、% = “hello world ” %  D、% ! “hello world ” %

考题 顺序执行下列程序语句后,则b的值是() String str = "Hello"; String b = str.substring(0,2);A、HelloB、helloC、HeD、null

考题  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.

考题 单选题以下涉及字符串数组、字符指针的程序段,不会产生编译错误的是(  )。A char*str,name[10]; str=Hello World;B char*str,name[10]; name=Hello World;C char str1[10]=prog.c, str2[10]; str2=str1;D char head_line[]; head_line=== == == == == == =;

考题 单选题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.

考题 单选题Which SELECT statement will the result ‘ello World’ from the string ‘Hello World’?()A SELECT SUBSTR( ‘Hello World’,1) FROM dual;B SELECT INITCAP(TRIM (‘Hello World’, 1,1)) FROM dual;C SELECT LOWER(SUBSTR(‘Hello World’, 1, 1) FROM dual;D SELECT LOWER(SUBSTR(‘Hello World’, 2, 1) FROM dual;E SELECT LOWER(TRIM (‘H’ FROM ‘Hello World’)) FROM dual;

考题 单选题下列选项中,()是正确的表达式。A % String s = “hello world ” ;%  B % = “hello world ” ;% C % = “hello world ” %  D % ! “hello world ” %

考题 单选题若有定义语句:char str1[] = "string", str2[8], *str3, str4[10] = "string";库函数strcpy的功能是复制字符串,以下选项中错误的函数调用是(  )。A strcpy(str3, "HELLO!");B strcpy(str2, "HELLO!");C strcpy(str1, "HELLO!");D strcpy(str4, "HELLO!");