JAVA精华
JAVA SE
深入JAVA API
Lang包
String类和StringBuffer类
位于java.lang包中,这个包中的类使用时不用导入
String类一旦初始化就不可以改变,而stringbuffer则可以。它用于封装内容可变的字符串。它可以使用tostring()转换成string字符串。
String x=”a”+4+”c”编译时等效于String x=new StringBuffer().append(“a”).append(4).append(“c”).toString();
字符串常量是一种特殊的匿名对象,String s1=”hello”;String s2=”hello”;则s1==s2;因为他们指向同一个匿名对象。
如果String s1=new String(“hello”);String s2=new String(“hello”);则s1!=s2;
/*逐行读取键盘输入,直到输入为“bye”时,结束程序
注:对于回车换行,在windows下面,有\r和\n两个,而unix下面只有\n,但是写程序的时候都要把他区分开*/
public class readline
{
public static void main(String args[])
{
Strin
您可能关注的文档
- ConationAsAnImportantFactorofMind.doc
- Conceptualframework.doc
- Condition-参数详细.doc
- ConfigurableMaterial-MaterialCreation.doc
- confluence4x破解.doc
- Constellation1550nm系统传输平台.doc
- Constipation in children.doc
- continuityhypothesisinsocialsciences.doc
- contraction英文简写.doc
- ContractLawofthePeople39;sRepublicofChina.doc
最近下载
- 社区获得性肺炎(CAP)护理查房.pptx
- 2025级中华民族共同体概论多选题测试卷附答案.docx VIP
- 久益艾柯夫采煤机分析比对.pptx VIP
- 发热待查诊治专家共识(2026版)解读.pptx VIP
- Eickhoff艾柯夫采煤机各部件结构特点.ppt VIP
- 2025级中华民族共同体概论题库(单选题)测试卷附答案.docx VIP
- 安徽省合肥市普通高中六校联盟2024-2025学年高一下学期4月期中考试 英语 PDF版含答案 .pdf VIP
- 2026年江苏中考化学工艺流程题专项试卷(附答案解析).docx VIP
- 艾柯夫采煤机技术规格新.pdf VIP
- 神东SL1000艾柯夫煤机说明.doc VIP
原创力文档

文档评论(0)