电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

西农java英语实习题目

5页
  • 卖家[上传人]:s9****2
  • 文档编号:457179431
  • 上传时间:2023-02-10
  • 文档格式:DOC
  • 文档大小:71KB
  • / 5 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • 1、Lab 4In this lab, you will practice how to use the following classes: l BufferedReader and BufferedWriterl BufferedOutputStream and BufferedIutputStream (Similar to BufferedReader and BufferedWriter, I am sure you can handle them.) l FileOutputStream and FileInputStreaml DataOutputStream and DataInputStreaml RandomAccessFilel ObjectInputStream and ObjectOutputStreamTask 1. Create a class MyLog and it implements one interface called Loggable. This class is used to read and write “MyLog.log” which

      2、 contains: the current time, the log type and the content. The definition of Loggable is as follows:interfaceLoggable / Three log types: NFORMATION, WARNING, ERRORenum TYPE INFORMATION, WARNING, ERROR;/ Add one log, including log type and log content.void addLog(Loggable.TYPE type, String logContent);/ Show all the logs in the log file.void readLog();The requirements are:l When new logs are added using addLog(), they should be appended to the log file. For example:l When using readLog() to show

      3、all the logs in the console, convert all the lower case characters into upper case characters for the contents of each log. For example:*2010-12-25 14:40:02INFORMATIONTHIS IS A CONTENT STRING*2010-12-25 14:45:02INFORMATIONTHIS IS A CONTENT STRING*Tips:l Use BufferedReader and BufferedWriter to read and write the log file.l To get the enum value, use:type.toString() in the addLog().l Pay attention to the date format, you may use the class: SimpleDateFormat. Task 2. Use FileOutputStream and Buffer

      4、edOutputStream separately to write 1,000,000 random numbers (double) into a binary file (Numbers.dat) and compare the time expenses. Write the results and error messages into MyLog.log (it is the same log file as in the Task 1).l The result is as follows:l The content of the log file is as follows:*2011-11-28 15:06:57INFORMATIONDone, cost 573 without buffer*2011-11-28 15:06:57INFORMATIONDone, cost 9 with buffer*2010-12-05 15:07:04ERRORAccess Deny!*l After changing the Number.dat into “Read only”

      5、,run the program again and add the following log. Tips:l To calculate the time using:longstartTime = System.currentTimeMillis();/ do somethinglongendTime = System.currentTimeMillis();long cost = endTime - startTime;l Use DataOutputStream and writeDouble()to write data.Task 3. Write code to search data from Numbers.dat by inputting the index of the data you are going to search. The result is as follows:Tips:Use class: RandomAccessFile.Task 4 Write an object of Student in to Student.txt, and read the object to show the following information:class Student implements Serializable private static final long serialVersionUID = 1L;int id;int age;String name;String department;public Student(int id, String name, int age, String department) this.id = id;this.name = name;this.age = age;this.department = department;

      《西农java英语实习题目》由会员s9****2分享,可在线阅读,更多相关《西农java英语实习题目》请在金锄头文库上搜索。

      点击阅读更多内容
    最新标签
    监控施工 信息化课堂中的合作学习结业作业七年级语文 发车时刻表 长途客运 入党志愿书填写模板精品 庆祝建党101周年多体裁诗歌朗诵素材汇编10篇唯一微庆祝 智能家居系统本科论文 心得感悟 雁楠中学 20230513224122 2022 公安主题党日 部编版四年级第三单元综合性学习课件 机关事务中心2022年全面依法治区工作总结及来年工作安排 入党积极分子自我推荐 世界水日ppt 关于构建更高水平的全民健身公共服务体系的意见 空气单元分析 哈里德课件 2022年乡村振兴驻村工作计划 空气教材分析 五年级下册科学教材分析 退役军人事务局季度工作总结 集装箱房合同 2021年财务报表 2022年继续教育公需课 2022年公需课 2022年日历每月一张 名词性从句在写作中的应用 局域网技术与局域网组建 施工网格 薪资体系 运维实施方案 硫酸安全技术 柔韧训练 既有居住建筑节能改造技术规程 建筑工地疫情防控 大型工程技术风险 磷酸二氢钾 2022年小学三年级语文下册教学总结例文 少儿美术-小花 2022年环保倡议书模板六篇 2022年监理辞职报告精选 2022年畅想未来记叙文精品 企业信息化建设与管理课程实验指导书范本 草房子读后感-第1篇 小数乘整数教学PPT课件人教版五年级数学上册 2022年教师个人工作计划范本-工作计划 国学小名士经典诵读电视大赛观后感诵读经典传承美德 医疗质量管理制度 2
    关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
    手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
    ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.