// 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. JavaScript获取地址栏内容

    例如地址为:http://www.mazey.net/baby/blog/index.php?a=1&b=2#c var query = window.location.href; //htt ...

  2. ThinkPHP在入口文件中判断是手机还是PC端访问网站

    <?php// +----------------------------------------------------------------------// | ThinkPHP [ WE ...

  3. python的语法规范及for和while

    1.缩进: 空白在Python中是重要的.事实上行首的空白是重要的.它称为缩进.在逻辑行首的空白(空格和制表符)用来决定逻辑行的缩进层次,从而用来决定语句的分组.这意味着同一层次的语句必须有相同的缩进 ...

  4. 我的Java开发学习之旅------>Eclipse 项目有红感叹号解决之道

    今天一个读者问我关于Android通过调用Webservice实现天气预报这篇文章的源码下载后出现的错误 Could not find class 'org.ksoap2.transport.Http ...

  5. 微信小程序排行榜

    哪类微信小程序使用量最多?小程序是附属在微信上,微信小程序排行榜跟微信的用户属性有很大的关系,微信用户对新闻资讯.情感.养生表现出了极大的兴趣,所有我们从新闻资讯小程序.视频小程序.情感类微信小程序. ...

  6. R语言(一)

    向量运算 R的强大功能之一就是把整个数据向量作为一个单一对象来处理.一个数据向量仅是数字的排列,一个向量可以通过如下方式构造 weight<-c(,,,) weight [] 结构c(--)用来 ...

  7. mysql学习笔记—常用sql函数

    SQL 拥有很多可用于计数和计算的内建函数. SQL Aggregate 函数 SQL Aggregate 函数计算从列中取得的值,返回一个单一的值. 有用的 Aggregate 函数: AVG() ...

  8. 在GCE上安装Apache、tomcat等

    1.安装Apache2.2.3 (虚机的操作系统是CentOS7) sudo yum install wget -y cd /opt sudo wget http://archive.apache.o ...

  9. 通用TryParse

    using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Refle ...

  10. LeetCode:罗马数字转整数【13】

    LeetCode:罗马数字转整数[13] 题目描述 罗马数字包含以下七种字符: I, V, X, L,C,D 和 M. 字符 数值 I 1 V 5 X 10 L 50 C 100 D 500 M 10 ...