首页 > 行业知识
题目内容 (请给出正确答案)
[单选题]

创建字符串s:String s = new String(“hello”);以下哪条语句将改变s的值()

A.String str = s.append(“aaa”);

B.String str = s.concat(s);

C.String str = s.substring(3);

D.以上语句都不会

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“创建字符串s:String s = new String(“…”相关的问题
第1题
下列程序的作用是:输入一个字符串,将其逆序输出。 说明:在窗体上放置两个文本框控件,其名称分
别为Text1和Text2,分别存放输入的字符串和逆序后的字符串,单击窗体上的Command1按钮,将把Text1中输入的字符串反序后输出到Text2中。程序运行时的界面如图20-14所示。

Private Sub Command1_Click() Dim y As String,S As String S=Text1.Text 【 】 TextText=y End Sub Private Sub Rever(S As String,y As String) Dim i As Integer y=" " For i=Len(S) To 1 Step-1 y=y&【 】 Next i End Sub

点击查看答案
第2题
下列程序用来将从键盘上输入的2个字符串进行比较,然后输出2个字符串中第1个不相同字符的ASCII码
之差。例如,输入的2个字符串分别为abcdef和abceef,则输出为-1。 include main () { char str [100], str2 [100], c; int i,s; printf("\n input string 1:\n"); gest(str1); printf("\n input string 2:\n"); gest(str2); i=0; while((strl[i]==str2[i]&&(strl[i]!=【 】)) i++; s=【 】; printf(.%d\n",s);

点击查看答案
第3题
下列程序实现从控制台输入并读取输出字符串。请将程序补充完整。 import java. io.*; publ
icClassCharInput { public static void main(StringArgsl[])throws java.io.IOException { String s: InputStreamReader ir; BufferedReader in; ir=new______(System.in): in=new______(ir): while(s=in.______!null) { System.out.println("Read:"+s): } } }

点击查看答案
第4题
以下程序的功能是找出三个字符串中的最大串。 【 】 include<stdio.h> main()

以下程序的功能是找出三个字符串中的最大串。 【 】 include<stdio.h> main() { int i; char string[20],str[3][20]; (i=0;i<3;i++)gets(【 】 ); if(strcmp(str,str[0],str[1]>0)strcpy(string,str[0]); else strcpy(string,str[1]); if(strcmp(str[2],string)>【 】 )srtcpy(string,str[2]); printf("The largest string is\n%s\n",string); }

点击查看答案
第5题
给定程序MODI1.C中函数fun的功能是:求出字符串中最后一次出现的子符串的地址,通过函数值返回,在
主函数中输入从此地址开始的字符串;若未找到,则函数值为 MULL。例如,当字符串中的内容为:"abcdabfcdx",t中的内容为:"ab"时,输出结果应是 abfacdx,当字符串中的内容为:"abcdabfabcdx",t中的内容为:"abd"时,则程序的输出信息: not be found! include <conio.h> include <stdio.h> include <string.h> char*fun(char*s,char*t) { char*p,*r,*a; /************found************/ a=Null; while(*s) { p=s;r=t; while(*r) /************found************/ if(r==p) {r++;p++;} else break; if(*r==\0,)a=s; s++; } return a; } main() { char s[100],t[100],*p; clrscr(); printf("\nPlease enter string S:"); scanf("%s"s); printf("\nPlease enter substring t:"); scanf("%s",t); p=fun(s,t); if(p)printf("\nThe result is:%s\n",p); else printf("\nNot found !\n"); }

点击查看答案
第6题
给定的程序中,fun函数的功能是:将s所指字符串中除了下标为偶数,同时ASCH值为偶数的字符除外,其余
的全部删除;串中剩余字符所形成的一个新串放在t所指的数组中。如:若s所指字符串中的内容为:”desktop12345",t所指字符串中的内容为:"dtp24"。 请在程序的下划线处填写正确的内容,使程序得到正确的结果。 inClUde <conio.h> include <stdio.h> include <string.h> void fun (Char *s,char t[]) { int i,j; for(i=0,j=0;(1);i++) if(i%2==0&&s[i]%2==0) (2); (3); } main() { char s[100],t[100]; clrscr(); printf("\nPlease enter string S:"); scanf("%s",s); fun(s,t); printf("\n The result is:% s\n",t); NONO();/*本函数与考生答题无关,考生不得改动,否则后果自负。*/ }

点击查看答案
第7题
下列是对Java的引用的描述错误的是()

A.强引用:最普遍的一种引用方式,如String s = “abc”,变量s就是字符串“abc”的强引用,只要强引用存在,则垃圾回收器就不会回收这个对象

B.软引用:用于描述还有用但非必须的对象,如果内存足够,不回收,如果内存不足,则回收

C.虚引用:就是形同虚设,虚引用并不会决定对象的生命周期

D.弱引用:弱引用和软引用大致相同,如果内存足够,不回收,如果内存不足,则回收

点击查看答案
第8题
下面程序段是创建一个Date类的对象并把它串行化保存到文件中,该对象表示的是运行时刻的日期及时
间,请将程序补充完整。 import java.util.*; import Java.io.*; public class SerializeDate{ Date d; SerializeDate(){ d=new Date(); try{ FileOutputStream f=new EileOutputStream("date.ser"); ObjectOutputStream s=new ObjectOutputStream(f); 【 】 f.close(); } catch(IOException e){ e.printStackTrace(); } } public static void main(String args[]){ SerializeDate b=new SerializeDate(); System.out.println("The saved date is;"+b.d.to String()); } }

点击查看答案
第9题
1下面程序段是创建一个Date类的对象并把它串行化保存到文件中,该对象表示的是运行时刻的日期及时
间,请将程序补充完整。 import java.util.*: import java.io.*; public class SefializeDate{ Date d; SerlalizeDate() { d=new Date(); try{ FileOutputStream f=new FileOutputStream("date.ser"); ObjectOutputStream s=new ObjectOutputS~eam(f); 【 】 f.close(); } catch(IOException e) { e.prlmStackTrace(); } } public static void main(String args[]){ SerializeDate b=new SefiatizeDate(); System.out.prinfln("The saved date is:"+b.d.toString()); } }

点击查看答案
第10题
编程创建一个Person类,该类属性包括姓名、性别、年龄三个属性。该类包括一般方法public String getInfo()把Person对象的所有信息组成一个字符串,及初始化所有成员变量的构造方法。 定义一个学生类Student,它继承Person类。该类需要满足以下要求: 1、 Student类有以下几个变量。(1)继承自父类的变量(2)子类新增的变量:学号,哲学课成绩,英语课成绩,计算机
点击查看答案
第11题
A.They should find a better lab for the project.B.The man should meet his partner's ne

A.They should find a better lab for the project.

B.The man should meet his partner's needs.

C.They should come to a compromise.

D.The man should work with somebody else.

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改