上一页 1 ··· 6 7 8 9 10 11 下一页

2012年10月19日

泛型限定

摘要: package Demo;import java.util.*;import java.util.Comparator;import java.util.Iterator;import java.util.TreeSet;public class Demo2 { public static void main(String[] args) { ArrayList<person> al=new ArrayList<person>(); al.add(new person("aa1")); al.add(new person("aa3" 阅读全文

posted @ 2012-10-19 17:16 蝌蚪的精神 阅读(146) 评论(0) 推荐(0) 编辑

单例模式

摘要: package Demo;public class Demo1 { public static void main(String[] args) { Single s=Single.getInstanceof(); Single s1=Single.getInstanceof(); s.setName("liliang"); String d=s1.getName(); System.out.print(d); }}class Single{ private String name; publ... 阅读全文

posted @ 2012-10-19 17:15 蝌蚪的精神 阅读(127) 评论(0) 推荐(0) 编辑

反射常见方法

摘要: package Demo1; import java.io.InputStream;import java.util.List;//被反射类public class person { public String name="li liangliang"; public person() { System.out.print("my name is person"); } public person(String name,int age) { System.out.println("name="+ name+" age=&q 阅读全文

posted @ 2012-10-19 17:12 蝌蚪的精神 阅读(208) 评论(0) 推荐(0) 编辑

文件过滤器

摘要: public static void main(String[] args) throws IOException { method_6(); } public static void method_6() { File file=new File("c:\\"); String[] names=file.list(new FilenameFliter_by());//得到文件目录 for(String name:names) { sop(name); } ... 阅读全文

posted @ 2012-10-19 17:06 蝌蚪的精神 阅读(127) 评论(0) 推荐(0) 编辑

文件常见操作属性

摘要: package Demo1;import java.io.File;import java.io.IOException;import java.text.DateFormat;import java.util.Arrays;import java.util.Date;public class Demo { public static void main(String[] args) throws IOException { method_6(); } public static void method_6() { File file=ne... 阅读全文

posted @ 2012-10-19 16:58 蝌蚪的精神 阅读(164) 评论(0) 推荐(0) 编辑

2012年10月17日

字符流与字节流练习

摘要: import java.io.*;import java.io.IOException;class IODemo{ public static void main(String[] args)throws IOException { method_14(); } public static void method_15()throws IOException { FileReader fr=new FileReader("a.txt"); BufferedReader bufr=new BufferedRe... 阅读全文

posted @ 2012-10-17 17:03 蝌蚪的精神 阅读(161) 评论(0) 推荐(0) 编辑

2012年10月16日

字符流,字节流总结

摘要: 想要知道开发用到哪些对象,只要通过四个明确即可1,明确源和目的 愿:InputStream Reader 目的:OutputStream Writer2,明确数据是否是纯文本数据 愿: 愿:是纯文本:Reader 否:InputSteam 目的:是纯文本Writer 否:OutputStream3,明确具体设备 原设备: 硬盘:File 键盘:System.in 内存:数组 网络:Socker流 目的设备 硬盘:File 键盘:Sys... 阅读全文

posted @ 2012-10-16 23:36 蝌蚪的精神 阅读(207) 评论(0) 推荐(0) 编辑

设置行号代码

摘要: import java.io.*;class DemoBuffer{ public static void main(String[] args)throws Exception { FileReader file=new FileReader("abc.txt"); LineNumberReader lnr=new LineNumberReader(file); String line=null; while((line=lnr.readLine())!=null) { Syste... 阅读全文

posted @ 2012-10-16 16:46 蝌蚪的精神 阅读(159) 评论(0) 推荐(0) 编辑

随机数判断最值

摘要: import java.util.*;class Demotwo{ public static void main(String[] args) { Random r=new Random(); int num[]=new int[10]; for(int x=0;x<num.length;x++) { num[x]=r.nextInt(10); System.out.print(num[x]+","); } max(num); min(nu... 阅读全文

posted @ 2012-10-16 16:08 蝌蚪的精神 阅读(158) 评论(0) 推荐(0) 编辑

字符流读取文件

摘要: import java.io.*;class Demo33{ public static void main(String[] args)throws Exception { FileReader fr=new FileReader("abc.txt"); BufferedReader bufr=new BufferedReader(fr); char[] ch=new char[1024]; int num=0; while((num=bufr.read(ch))!=-1) { ... 阅读全文

posted @ 2012-10-16 16:06 蝌蚪的精神 阅读(124) 评论(0) 推荐(0) 编辑

上一页 1 ··· 6 7 8 9 10 11 下一页

导航