java学习
2015-11-18 11:13
351 查看
好久没有写java代码了,打算从今天开始练练java程序,这是java简单的文件操作的代码
import java.io.*;
public class tianjiawenjian {
public static void main(String args[]){
File f=new File("F:\\csai.txt");
try{
FileWriter outf = new FileWriter(f);
BufferedWriter bufout=new BufferedWriter(outf);
bufout.write("welcom to here!");
bufout.newLine();
bufout.write("I am jx!");
bufout.newLine();
bufout.flush();
bufout.close();
outf.close();
}catch(IOException e)
{
}
System.out.println(f.getName());
System.out.println(f.length());
System.out.println(f.getAbsolutePath());
System.out.println(f.getParent());
}
}
看起来很简单,只是在本地写文件的代码。
import java.io.*;
public class tianjiawenjian {
public static void main(String args[]){
File f=new File("F:\\csai.txt");
try{
FileWriter outf = new FileWriter(f);
BufferedWriter bufout=new BufferedWriter(outf);
bufout.write("welcom to here!");
bufout.newLine();
bufout.write("I am jx!");
bufout.newLine();
bufout.flush();
bufout.close();
outf.close();
}catch(IOException e)
{
}
System.out.println(f.getName());
System.out.println(f.length());
System.out.println(f.getAbsolutePath());
System.out.println(f.getParent());
}
}
看起来很简单,只是在本地写文件的代码。
相关文章推荐
- Struts2标签注意点
- java jvm学习笔记十一(访问控制器)
- Could not find artifact javax.jdo:jdo2-api:jar:2.3-ec in central
- java compiler level does not match the version of the installed java project facet 解决方法
- 自己实现spring核心IOC部分
- eclipse使用—正则表达式匹配替换
- eclipse2studio
- eclipse+git
- java jvm学习笔记十(策略和保护域)
- SSH:Spring框架(利用注解实现spring基本配置详解)
- Java的位运算符详解实例——与(&)、非(~)、或(|)、异或(^)【转】
- java jvm学习笔记九(策略文件)
- java中的位移符
- java用spilt方法分割ip地址
- java精度问题
- Spring+SpringMVC+mybatis+easyui整合实例(一)实例介绍
- java jvm学习笔记八(实现jar包的代码签名)
- eclipse的activiti插件安装
- eclipse中 NoclassdefFoundError错误的分析
- JAVA--关键字final