下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、姓名: 王定欢 学号:188 班级: 日期: 成绩:JAVA实验四一、实验目的:Fundamental Programming Structures in Java: Strings二、实验要求:1 Write a program called and do the following:2. Create a String object that accepts input from the userReferencing the JDK docs,execute 2 different methods on the StringPrint the results of the methods
2、3 Write a program called that does the following:4. Create a StringBuffer object Referencing the JDK docs, execute 2 different methods on the StringBuffer Print the results of the methods5. Write a program called that accepts a string, looks for commas within the string, andbreaks the string up into
3、 the parts separated by the commaFor example, the stringKunming, Yunnan, China would return three strings:6. Stringl = Kunming7. String2 = YunnanR8. String3 = China*三、实验内容:1、代码:package lab4;import class Stringl ;public static void main(String args)Hplease input a string1);Scanner _in = new Scan net;
4、String in put =():the in put string is十 input);please input a stringthis is a stringthe input string is:this is a stringthe uppercase string is:THIS IS A STRINGthe string length is:16();ppend(nworldM);String T;i) (i;逆序为:+rs);实验结果:please input a string with commas: kunmingf yunnan,china|stringl=kunmi
5、ngString2=yunnanString3=china逆序为;anihcf nannuyA gnimnuk4.附加题:代码:package lab4;import class lab4 public static void main(Stringargs)String name = new String(*My name is 1 ilei;the length of string is:*+();char firstChar = (0) ;/第一个位置the first char is:irstChar);*the last char is: +()T) ;/最后一个位置Str in gTokenizer str = new StringTokenizer (name, * ”); the first world is: *+();String】 strl = C ”); /7找出 lilei的位置 int length =;the place of LiLei is: M+length);.实验结果the length of string is:16 the first char is:Mth巳 last char is:ithe
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 未来五年人工卸料密闭离心机企业数字化转型与智慧升级战略分析研究报告
- 未来五年地毯、挂毯类工艺品企业数字化转型与智慧升级战略分析研究报告
- 未来五年复合材料热压罐设备企业数字化转型与智慧升级战略分析研究报告
- 未来五年均化或乳化机械企业数字化转型与智慧升级战略分析研究报告
- 未来五年工业品B2B企业数字化转型与智慧升级战略分析研究报告
- 《汽车检测仪》-《汽车检测仪》-6项目一 1.6 汽车数据流检测与分析
- (2025年)后路全脊柱内窥镜技术治疗神经根型颈椎病的中国专家共识课件
- 六年级上册第四单元整本书阅读《童年》导读课教学课件
- 《烟文化与人类健康》课件-6.2烟文化与民族习俗
- 《烟文化与人类健康》课件-4.7卷烟具的文化与艺术
- 中国糖尿病防治指南2
- 贵州省遵义市仁怀市2024-2025学年七年级上学期期末检测数学试卷(原卷版+解析版)
- 国家开放大学电大《国际私法》形考任务1-5题库及答案
- 天津市和平区2024-2025学年度八年级物理上学期期末质量调查试卷
- QSB知识培训资料重点
- 地理七上复习课件
- GB/T 9390-2017导航术语
- GB/T 1962.1-2015注射器、注射针及其他医疗器械6%(鲁尔)圆锥接头第1部分:通用要求
- GA/T 527.1-2015道路交通信号控制方式第1部分:通用技术条件
- 北京市西城区2021-2022学年第一学期期末初三物理试题及答案(PDF版)
- 室内精装修分包工程策划汇报课件
评论
0/150
提交评论