摘要:Interface separates what a Class does and how does it work. List interface lets different type of List to implement its own method. interface has more
阅读全文
摘要:static class is used to when you don't need to instantiate the class. Like Math class, instantiating it is unnecessary. Final class prevents extension
阅读全文
摘要:如果两个对象调用equals返回相等,那么这两个对象调用hashCode方法必须返回相同的整数。如果不重写hashCode,会违反该原则。这个原则主要针对的是映射操作(map接口)。 注意: 1. String重写了Object的equals,现在比较的是两个String所包含的char seque
阅读全文
摘要:Prior to Java 5, there are a lot of casting in collections, since in collection you add objects and cast the object you get back from collection. Prov
阅读全文
摘要:Internally, both classes use array. Vector by default double the array size when array is full, while ArrayList increases the array size by 50%.Vector...
阅读全文