java for语句的一个用法
摘要:上代码:package com.wjy;public class Test {public static void main(String[] args) {int[] attay = new int[5];for (int i : attay) {System.out.println("it is " + i);}}}运行结果:it is 0it is 0it is 0it is 0it is 0
阅读全文
java类的一些特殊效果
摘要:上代码:package com.wjy;public class Test { public static void main(String[] args){ Student s1=new Student(99); }}class Student{public static Student stu=new Student(22);//这里必须要static修饰,否则会出错。public Student(int age){System.out.println("The age is: "+age);}}运行结果:The age is: 22The age is: 99再看一个
阅读全文
java中map list set 用法以及区别
摘要:转自:http://j2eemylove.iteye.com/blog/1195823List,Set,Map是否继承自Collection接口? 答:List,Set是,Map不是。 如图: Collection ├List │├LinkedList │├ArrayList │└Vector │ └Stack └Set Map ├Hashtable ├HashMap └WeakHashMap Collection是最基本的集合接口,一个Collection代表一组Object,即Collection的元素。一些Collection允许相同的元素而另一...
阅读全文
java set的使用
摘要:Set的继承关系:Collection └Set Set特点:元素无放入顺序,元素不可重复(注意:元素虽然无放入顺序,但是元素在set中的位置是有该元素的HashCode决定的,其位置其实是固定的) Set接口有两个实现类:HashSet(底层由HashMap实现),LinkedHashSet SortedSet接口有一个实现类:TreeSet(底层由平衡二叉树实现) set 一般无序不重复代码如下:package com.wjy;import java.util.HashSet;import java.util.Iterator;import java.util.Set;public c..
阅读全文
java map的使用
摘要:Map的继承关系如下图:Map ├Hashtable ├HashMap └WeakHashMap 注意:Map没有继承Collection接口,Map提供key到value的映射。一个Map中不能包含相同key,每个key只能映射一个value。Map接口提供3种集合的视图,Map的内容可以被当做一组key集合,一组value集合,或者一组key-value映射。Map特点:元素按键值对存储,无放入顺序 Map接口有三个实现类:HashMap,HashTable,LinkeHashMap HashMap非线程安全,高效,支持null HashTable线程安全,低效,不支持nul...
阅读全文
java List的使用
摘要:先看List的继承关系图:Collection ├List │├LinkedList │├ArrayList Collection是最基本的集合接口,一个Collection代表一组Object,即Collection的元素。一些Collection允许相同的元素而另一些不行。一些能排序而另一些不行。Java JDK不能提供直接继承自Collection的类,Java JDK提供的类都是继承自Collection的"子接口",如:List和Set。 List特点:元素有放入顺序,元素可重复 List<E>([]内的内容可省略),与数组类似:实例化:List[&l
阅读全文
关于java文本编辑器注解的英文文章----很好
摘要:原网址:http://www.eclipse.org/articles/Article-Folding-in-Eclipse-Text-Editors/folding.htmlFolding in Eclipse Text EditorsSummary Starting with release 3.0, Eclipse allows folding in its text editor. In this article, I explain the new projection infrastructure introduced in the JFace Text framework and
阅读全文