2013年12月9日
摘要: 1 FileReader fr=new FileReader("buf.txt"); 2 BufferedReader bur=new BufferedReader(fr); 3 4 FileWriter fw=new FileWriter("coptest.txt"); 5 BufferedWriter buf=new BufferedWriter(fw); 6 String str=null; 7 while((str=bur.readLine())!=null){ ... 阅读全文
posted @ 2013-12-09 10:26 ざ柒 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1 public class Test { 2 3 /** 4 * @param args 5 */ 6 public static void main(String[] args) { 7 // TODO Auto-generated method stub 8 File dir = new File("E:\\Test\\JAVA"); 9 FilenameFilter filter = new FilenameFilter() {10 11 @Override12 ... 阅读全文
posted @ 2013-12-09 00:14 ざ柒 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 定义功能,获取一个应用程序运行的次数,如果超过5次,给出使用次数已到请注册的提升,并不要在运行程序 1 public static void main(String[] args) throws IOException { 2 // TODO Auto-generated method stub 3 getAppcount(); 4 } 5 public static void getAppcount() throws IOException{ 6 //将配置文件封装成File对象 7 File confile=n... 阅读全文
posted @ 2013-12-09 00:12 ざ柒 阅读(156) 评论(0) 推荐(0) 编辑
  2013年12月8日
摘要: 将1.txt,2.txt,3.txt文件中的数据合并到一个文件中实例1 1 public static void demo_2() throws IOException { 2 // TODO Auto-generated method stub 3 ArrayList al=new ArrayList(); 4 for(int x=0;x en=Collections.enumeration(al); 8 SequenceInputStream sis=new SequenceInputStream(en); 9 // Buffe... 阅读全文
posted @ 2013-12-08 23:06 ざ柒 阅读(136) 评论(0) 推荐(0) 编辑
  2013年12月7日
摘要: 1,明确源和目的 源InputStream Reader 目的OutputStream Writer2,明确数据是否为纯文本数据 源:是纯文本:Reader 否:InputStream 目的:是否文本:Writer 否:OutputStream 这里就可以明确需求中具体要使用哪个体系 3,明确具体的设备 源设备: 硬盘:File 键盘:System.in 内存:数组 网络:Socket流 目的设备: 硬盘:File 控制台:System.out 内存:数组 网络:Socket流 4,是否需要其他额外功能 1,是否需要高效(缓冲区) 是,就加上Buffer 阅读全文
posted @ 2013-12-07 15:54 ざ柒 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1 //创建容器 2 StringBuilder sb=new StringBuilder(); 3 //获取键盘读取流 4 InputStream in=System.in; 5 //定义变量记录读取到的字节,并循环获取 6 int ch=0; 7 while((ch=in.read())!=-1){ 8 if(ch=='\r') 9 continue;10 if(ch=='\n'){11 ... 阅读全文
posted @ 2013-12-07 11:08 ざ柒 阅读(249) 评论(0) 推荐(0) 编辑
  2013年12月3日
摘要: 将日期对象-->日期格式的字符串使用的是DateFormat类中的Format方法 1 Date date = new Date(); 2 // 获取日期格式实例,具体着默认的风格.FULL LONG等指定风格 3 DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.LONG);// 时间 4 //dateFormat = DateFormat.getDateTimeInstance();// 显示日期和时间 5 6 // 自定义风格 7 d... 阅读全文
posted @ 2013-12-03 20:56 ざ柒 阅读(118) 评论(0) 推荐(0) 编辑
  2013年11月28日
摘要: 集合的技巧需要唯一吗需要:Set 需要制定顺序: 需要:TreeSet 不需要:HashSet 但是想要一个和存储一致的顺序(有序):LinkedHashSet不需要:List 需要频繁增删: 需要:LinkedList 不需要:ArrayList如何记录每一个容器的结构和所属提醒看名字:List --ArrayList --LinkedList Set --HashSet --TreeSet 后缀名就是该集合所属体系前缀名就是该集合的数据结构看到array:就要想到数值,就要想到查询快有角标看到link:就要想到链表,就要想到增删快,就要想到add get remove+frist last 阅读全文
posted @ 2013-11-28 11:33 ざ柒 阅读(111) 评论(0) 推荐(0) 编辑
  2013年11月24日
摘要: 使用Collection 中的iterator()方法,调用集合中的迭代方法.简要说明步骤Collection coll=new ArrayList();coll.add("dd");coll.add("ds");;Iterator it=coll.iterator(); //定义迭代器while(it.hasNext()){//判断迭代器是否有元素System.out.println(it.next());//取出迭代器中的元素}开发使用下面这种1 Collection coll=new ArrayList();2 coll.add("dd& 阅读全文
posted @ 2013-11-24 13:53 ざ柒 阅读(126) 评论(0) 推荐(0) 编辑
  2013年11月23日
摘要: 思路:1,获取到字符串中的需要培训的数值(字符串中都是空格来对数值进行分隔的)2,把字符串对象的切割方法将字符串变为小串3,将小串变为int的数组4,对数值进行排序5,返回数组变为字符串 1 import java.util.Arrays; 2 3 public class WrapperTest { 4 private static final String SPACE_SEPARATOR=" "; 5 /** 6 * @param args 7 */ 8 public static void main(String[] args) { 9 ... 阅读全文
posted @ 2013-11-23 22:51 ざ柒 阅读(435) 评论(0) 推荐(0) 编辑