付费下载
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 青岛山东青岛市自然资源和规划局所属事业单位招聘高层次人才2人笔试历年参考题库附带答案详解
- 锡林郭勒2025年内蒙古锡林浩特市招聘公办幼儿园控制数内工作人员90人笔试历年参考题库附带答案详解
- 鄂尔多斯2025年内蒙古鄂尔多斯市杭锦旗教育领域校园专场招聘5名专业技术人员笔试历年参考题库附带答案详解
- 西双版纳2025年云南西双版纳勐海县林业和草原局护林员招聘笔试历年参考题库附带答案详解
- 自贡2025年四川自贡市贡井区事业单位选调教师6人笔试历年参考题库附带答案详解
- 焦作2025年河南沁阳市市直和教育系统事业单位招聘20人笔试历年参考题库附带答案详解
- 深圳2025年广东深圳市光明区卫生健康局招聘一般专干10人笔试历年参考题库附带答案详解
- 榆林2025年陕西榆林市横山区招聘政务辅助工作人员27人笔试历年参考题库附带答案详解
- 抚州2025年江西抚州市招聘卫生专业技术人员510人笔试历年参考题库附带答案详解
- 延安2025年陕西延安市延长县事业单位定向招聘退役大学生士兵笔试历年参考题库附带答案详解
- 生产现场资产管理制度
- 起重设备安全使用指导方案
- 江苏省扬州市区2025-2026学年五年级上学期数学期末试题一(有答案)
- 建筑与市政工程地下水控制技术规范
- 2024版2026春新教科版科学三年级下册教学课件:第一单元4.磁极与方向含2个微课视频
- 培训保安课件
- “党的二十届四中全会精神”专题题库及答案
- 2026届福建省宁德市三校高三上学期1月月考历史试题(含答案)
- 实验动物从业人员上岗证考试题库(含近年真题、典型题)
- 可口可乐-供应链管理
- XX公司印章管理办法
评论
0/150
提交评论