随笔分类 -  java study

上一页 1 2 3 4
块的作用
摘要:1 for(int i=0;i<10;i++)2 Integer k=new Integer(i);for循环可以不使用{}的,但仅限于执行语句(其中并不包括变量声明语句),由于这段代码在main中重复定义了Integer k,所以编译会出错,只要加上{},让变量声明在块内就可以了,块结束后,块内局部变量会被释放。 阅读全文
posted @ 2014-03-03 21:46 wf110 阅读(258) 评论(0) 推荐(0)
字符串 组合打印
摘要:1 static void DFS(List list,String str,int n) 2 { 3 System.out.println(str); 4 for (int i=0;i<list.size();i++) 5 { 6 LinkedList link=new LinkedList(list); 7 8 DFS(link,str+link.remove(i),++n); 9 }10 }View Code 用于处理字符串 ... 阅读全文
posted @ 2014-03-03 15:23 wf110 阅读(190) 评论(0) 推荐(0)
Java容器集合类的区别用法
摘要:Set,List,Map,Vector,ArrayList的区别JAVA的容器---List,Map,SetCollection├List│├LinkedList│├ArrayList│└Vector│ └Stack└SetMap├Hashtable├HashMap└WeakHashMapCollection接口 Collection是最基本的集合接口,一个Collection代表一组Object,即Collection的元素(Elements)。一些 Collection允许相同的元素而另一些不行。一些能排序而另一些不行。Java SDK不提供直接继承自Collection的类,Java . 阅读全文
posted @ 2014-03-03 13:25 wf110 阅读(272) 评论(0) 推荐(0)
java读取txt字符串挨个写入int数组
摘要:1 int []num=new int[1001]; 2 FileReader fr = new FileReader("1.txt"); 3 BufferedReader br = new BufferedReader(fr); 4 5 String str; 6 StringBuilder sb = new StringBuilder(); 7 while((str=br.readLine())!=null) 8 { 9 sb.append(str);10 }11 String st=sb.toString();12 int sum=0,mynu... 阅读全文
posted @ 2013-12-26 20:00 wf110 阅读(1529) 评论(0) 推荐(0)

上一页 1 2 3 4