随笔分类 -  Java

abstract class and interface
摘要: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 阅读全文

posted @ 2016-12-11 09:10 touchdown 阅读(93) 评论(0) 推荐(0)

final, static
摘要: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 阅读全文

posted @ 2016-12-11 02:00 touchdown 阅读(148) 评论(0) 推荐(0)

为什么重写equals方法必须重写hashCode?
摘要:如果两个对象调用equals返回相等,那么这两个对象调用hashCode方法必须返回相同的整数。如果不重写hashCode,会违反该原则。这个原则主要针对的是映射操作(map接口)。 注意: 1. String重写了Object的equals,现在比较的是两个String所包含的char seque 阅读全文

posted @ 2016-12-04 02:10 touchdown 阅读(101) 评论(0) 推荐(0)

Java generics
摘要: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 阅读全文

posted @ 2016-02-19 01:39 touchdown 阅读(159) 评论(0) 推荐(0)

Vector and ArrayList in Java
摘要: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... 阅读全文

posted @ 2016-01-22 13:51 touchdown 阅读(111) 评论(0) 推荐(0)

导航