摘要: Java泛型(generics)是JDK 5中引入的一个新特性,允许在定义类和接口的时候使用类型参数(type parameter)。声明的类型参数在使用时用具体的类型来替换。 泛型的本质是参数化类型,也就是说所操作的数据类型被指定为一个参数。 创建集合时就指定集合元素的类型,该集合只能保存其指定类 阅读全文
posted @ 2017-12-16 20:15 __Meng 阅读(323) 评论(0) 推荐(0)
摘要: Java为每种基本数据类型都提供了对应的包装器类型 从Java SE5开始就提供了自动装箱的特性,如果要生成一个数值为10的Integer对象,只需要这样就可以了: Integer i = 10; 这个过程中会自动根据数值创建对应的 Integer对象,这就是装箱。 实际上,执行上面那句代码的时候, 阅读全文
posted @ 2017-12-16 19:43 __Meng 阅读(361) 评论(0) 推荐(1)
摘要: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F 阅读全文
posted @ 2017-12-16 18:43 __Meng 阅读(142) 评论(0) 推荐(0)