下载此文档

实验04 Java输入输出流报告.doc


文档分类:IT计算机 | 页数:约8页 举报非法文档有奖
1/8
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/8 下载此文档
文档列表 文档介绍
实验四 Java 输入输出流 1 .实验目的(1) 掌握输入输出流的总体结构; (2) 掌握流的概念; (3) 了解各种流(包括文件流、过滤流、对象的序列化、随机访问)的使用。 2 .实验内容实验题 1 编写一个 Java Application 程序,打印命令行输入的所有参数。[ 基本要求] 编写完整程序。运行结果: 代码如下: import ; public mandOutPut { /** * ***@param args */ public static void main(String[] args) { // TODO Auto-generated method stub System. out .println( "Please input :" ); Scanner in = new Scanner(System. in ); String str = (); System. out .println( "The output results :" ); System. out .println(str); (); }} 实验题 2 通过键盘输入路径, 搜索指定路径下的全部内容。运行结果: 代码如下: .; import ; import ; import ; public class Output { /** * ***@param args * ***@throws IOException */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub String fileName = "d:\\" ; File file = new File(fileName); byte [] b= new byte [( int )()]; FileInputStream out= new FileInputStream(file); (b); (); String s= new String(b); // 将字节流转换为字符串 System. out .println(s); }} 实验题 3 设计一个类 FileRWTest, 实现从 文件中读入数据到字符数组 cBuffer 中,然后再写入到文件“ output .txt ”中。运行结果: 代码: .; import ; import ; import ; import ; import ; public class FileRWTest { /** * ***@param args * ***@throws IOException */ public static voi

实验04 Java输入输出流报告 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数8
  • 收藏数0 收藏
  • 顶次数0
  • 上传人63229029
  • 文件大小229 KB
  • 时间2017-06-18