// TODO Auto-generated method stub
//File file = new File("D:\\Android\\workspace\\Practice1\\src\\test4", "new1.txt");
//String str = file.getName();
//file.delete();

// try{
// Runtime rt = Runtime.getRuntime();
//
// File file = new File("D:\\Program Files (x86)\\CodeBlocks", "codeblocks.exe");
// System.out.println("打开codeblocks");
// rt.exec(file.getAbsolutePath());
// file = new File("D:\\酷狗\\KGMusic", "KuGou.exe");
// System.out.println("打开酷狗");
// rt.exec(file.getAbsolutePath());
// file = new File("D:\\净网大师\\ADSafe", "ADSafeSvc.exe");
// System.out.println("打开净网大师");
// rt.exec(file.getAbsolutePath());
// }catch(Exception e){
// System.out.println(e);
// }

// try{
// File f = new File("D:\\Android\\workspace\\Practice1\\src\\test4", "file.txt");
// FileInputStream in = new FileInputStream(f);
// int n = -1;
// byte [] a= new byte[100];
//
// while((n = in.read(a, 0, 100)) != -1){
// String s = new String(a, 0, n);
// System.out.print(s);
// }
// in.close();
// }
// catch(Exception e){
// System.out.println(e);
// }

// try{
// byte []b = "我是你爸爸".getBytes();
// File file = new File("D:\\Android\\workspace\\Practice1\\src\\test4", "empty.txt");
// FileOutputStream out = new FileOutputStream(file);
// out.write(b);
// out.close();
// out = new FileOutputStream(file, true);
// b = ",当文件字符输出流的构造方法中有true参数时,可以在文件末尾追加文字".getBytes();
// out.write(b);
//
// out.close();
//
// }
// catch(Exception e){
// System.out.println(e);
// }

// byte []b = "我是你大爷".getBytes();
// System.out.println(b);

// File sourceFile = new File("D:\\Android\\workspace\\Practice1\\src\\test4","a.txt");
// File targetFile = new File("D:\\Android\\workspace\\Practice1\\src\\test4","b.txt");
//
// char c[] = new char[19];
// try{
// Reader in = new FileReader(sourceFile);
// Writer out = new FileWriter(targetFile, true);
// int n = -1;
// while((n = in.read(c))!= -1){
// out.write(c, 0, n);
// }
// out.flush();//使缓冲区的内容马上写入目的地
// out.close();
// }catch(Exception e){
// System.out.println(e);
//
// }

// try{
//
// FileReader inOne = new FileReader("D:\\Android\\workspace\\Practice1\\src\\test4\\a.txt");
// BufferedReader bufferedRead = new BufferedReader(inOne);
//
// FileWriter tofile = new FileWriter("D:\\Android\\workspace\\Practice1\\src\\test4\\to.txt");
// BufferedWriter bufferedWrite = new BufferedWriter(tofile);
//
// String str = null;
//
// while((str = bufferedRead.readLine()) != null){
// StringTokenizer fenxi = new StringTokenizer(str);
// str = str + "单词个数:" + fenxi.countTokens();
// bufferedWrite.write(str);
// bufferedWrite.newLine();
// }
//
// bufferedWrite.close();
// tofile.close();
// bufferedRead.close();
// inOne.close();
//
//
// }
// catch(Exception e){
// System.out.println(e);
// }

//
// RandomAccessFile inAndOut = null;
// int data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 111};
// try{
// inAndOut = new RandomAccessFile("D:\\Android\\workspace\\Practice1\\src\\test4\\random.txt", "rw");
// for(int i = 0; i < data.length; i++){
// inAndOut.writeInt(data[i]);
// }
//
// for(long i = data.length - 1; i >= 0; i--){
// inAndOut.seek(i * 4);
// System.out.printf("\t%d", inAndOut.readInt());
// }
// inAndOut.close();
// }catch(Exception e){
// System.out.println(e);
// }
//

System.out.println(Math.round(-13.4));
char 坏 = '坏';

ok:while(true){
while(true){
System.out.println("我只循环一次");
break ok;
}
}

int num = (int)Math.random() * 100;

//break String s = null;
//char 好 = 坏;

}

java文件读写常用方法的更多相关文章

  1. java 文件读写的有用工具

    java 文件读写的有用工具 package org.rui.io.util; import java.io.BufferedReader; import java.io.File; import j ...

  2. java文件读写的两种方式

    今天搞了下java文件的读写,自己也总结了一下,但是不全,只有两种方式,先直接看代码: public static void main(String[] args) throws IOExceptio ...

  3. java文件读写操作

    Java IO系统里读写文件使用Reader和Writer两个抽象类,Reader中read()和close()方法都是抽象方法.Writer中 write(),flush()和close()方法为抽 ...

  4. java文件读写操作类

    借鉴了项目以前的文件写入功能,实现了对文件读写操作的封装 仅仅需要在读写方法传入路径即可(可以是绝对或相对路径) 以后使用时,可以在此基础上改进,比如: 写操作: 1,对java GUI中文本框中的内 ...

  5. Java 文件读写操作

    1[1]按字节读写,一次只读取一个字节,效率比较低 package bk1; import java.io.File; import java.io.FileInputStream; import j ...

  6. Java文件读写分析

    本文内容:IO流操作文件的细节分析:分析各种操作文件的方式. 读写一个文件 从一个示例开始分析,如何操作文件: /** * 向一个文件中写入数据 * @throws IOException */ pr ...

  7. java文件读写操作指定编码格式

    读文件: BufferedReader 从字符输入流中读取文本,缓冲各个字符,从而提供字符.数组和行的高效读取. 可以指定缓冲区的大小,或者可使用默认的大小.大多数情况下,默认值就足够大了. 通常,R ...

  8. java文件读写工具类

    依赖jar:commons-io.jar 1.写文件 // by FileUtilsList<String> lines = FileUtils.readLines(file, " ...

  9. java 文件读写--转载

    读文件 http://www.baeldung.com/java-read-file Java – Read from File 1. Overview In this tutorial we’ll ...

随机推荐

  1. 九度OJ 1360:乐透之猜数游戏 (递归)

    时间限制:2 秒 内存限制:32 兆 特殊判题:否 提交:955 解决:261 题目描述: 六一儿童节到了,YZ买了很多丰厚的礼品,准备奖励给JOBDU里辛劳的员工.为了增添一点趣味性,他还准备了一些 ...

  2. Ubuntu 16.04特性及使用基本方法

    十招让Ubuntu 16.04用起来更得心应手 Ubuntu 16.04 LTS的这十项新功能,每个Ubuntu用户必须要知道! Ubuntu 16.04 LTS安装好需要设置的15件事

  3. Python菜鸟之路:JavaScript基础

    前言 JavaScript 是属于网络的脚本语言,被数百万计的网页用来改进设计.验证表单.检测浏览器.创建cookies,以及更多的应用. 编写 1. 存在形式 方式一:存在js文件中,即写入js文件 ...

  4. PHP-Heredoc用法:<<<EOFEOF;

    Heredoc,用来输出大段的HTML和JavaScript <<<EOF后面不能有空格. EOF;末尾的结束符必须靠边,并且前面不能有空格和缩进符. 例如: $mazey=< ...

  5. 斯坦福大学Andrew Ng - 机器学习笔记(1) -- 单变量&多变量线性回归

    大概用了一个月,Andrew Ng老师的机器学习视频断断续续看完了,以下是个人学习笔记,入门级别,权当总结.笔记难免有遗漏和误解,欢迎讨论. 鸣谢:中国海洋大学黄海广博士提供课程视频和个人笔记,在此深 ...

  6. NPOI 导入 导出

    using NPOI.XSSF.UserModel;   using System.IO; 导入 /// <summary> /// Excel转换DataTable /// </s ...

  7. PyQt4 颜色选择,字体选择代码

    # -*- coding: utf-8 -*- """ ------------------------------------------------- File Na ...

  8. 高阶函数,map,filter,sorted

    Map:对列表中的每个元素进行操作 >>> def f(x): ...    return x * x ... >>> map(f, [1, 2, 3, 4, 5, ...

  9. Nginx常用命令(加入系统服务)

    nginx 服务器重启命令,关闭 nginx -s reload :修改配置后重新加载生效 nginx -s reopen :重新打开日志文件 nginx -t -c /path/to/nginx.c ...

  10. Python学习进程(13)文件与IO

        本节介绍基本的IO函数和文件的读写操作.     (1)读取键盘输入: Python用于读取键盘输入的函数有两个:raw_input与input. 1)raw_input函数 从标准输入读取一 ...