面试过程中经常会被问到JDK1.5的新特性,回答过程中都只能略说出一二。下来后翻阅了Oracle官方文档,在此列出,以供学习。
* Generics - This long-awaited enhancement to the type system allows a type or method to operate on objects of various types while providing compile-time type safety. It adds compile-time type safety to the Collections Framework and eliminates the drudgery of casting. See the Generics Tutorial. (JSR 14)
* Enhanced for Loop - This new language construct eliminates the drudgery and error-proneness of iterators and index variables when iterating over collections and arrays. (JSR 201)
* Autoboxing/Unboxing - This facility eliminates the drudgery of manual conversion between primitive types (such as int) and wrapper types (such as Integer). (JSR 201)
* Typesafe Enums - This flexible object-oriented enumerated type facility allows you to create enumerated types with arbitrary methods and fields. It provides all the benefits of the Typesafe Enum pattern ("Effective Java," Item 21) without the verbosity and the error-proneness. (JSR 201)
* Varargs - This facility eliminates the need for manually boxing up argument lists into an array when invoking methods that accept variable-length argument lists.
* Static Import - This facility lets you avoid qualifying static members with class names without the shortcomings of the "Constant Interface antipattern." (JSR 201)
* Annotations (Metadata) - This language feature lets you avoid writing boilerplate code under many circumstances by enabling tools to generate it from annotations in the source code. This leads to a "declarative" programming style where the programmer says what should be done and tools emit the code to do it. Also it eliminates the need for maintaining "side files" that must be kept up to date with changes in source files. Instead the information can be maintained in the source file. (JSR 175)
NOTE: The @Deprecated annotation provides a way to deprecate program elements. See How and When To Deprecate APIs.
分享到:
相关推荐
转载 jdk1.5的一些新特性,希望能帮助大家!
JDK1.5新特性
JDK1.5新特性泛型_深入研究JDK1.5新特性泛型_深入研究JDK1.5新特性泛型_深入研究
“JDK1.5”(开发代号猛虎)的一个重要主题就是通过新增一些特性来简化开发,这些特性包括泛型,for-else 循环,自动装包/拆包,枚举,可变参数, 静态导入
JDK 1.5新特性及应用JDK 1.5新特性及应用JDK 1.5新特性及应用
jdk1.5新特性 泛类型和泛型方法是Java5.0 中的新特性。一种泛类型用一个或多个泛型变量定义,可以有一个或多个,泛型变量做参数占位符或做返回值 的方法。
博文链接:https://weibaojun.iteye.com/blog/70284
jdk 1.5新特性笔记,泛型,注释等程序
包含 jdk1.5免安装、jdk1.6免安装、jdk1.8(32和64)
关于jdk1.5新特性的书,值得拥有,不错的资料
jdk1.5.exe jdk1.5 jdk1.5下载
jdk1.5新特性,泛型,for:each
JDK1.5,JDK1.5
绝版jdk1.5,非常不错的资源。用起来很好。是 Java语言对Bean类属性、事件的一种缺省处理方法。例如类A中有属性name,那我们可以通过getName,setName来得到其值或者设置新 的值。通过getName/setName来访问name属性,...
1.增强的for循环【foreach{}迭代数组或集合】 格式:for(变量的类型 变量名:集合变量名 ){} 注意:集合变量可以是数组或实现了Iterable接口的集合类 2.静态导入(这样调用一个静态方法的时候就不需要【类名....
前几天上传过这个资源,因为是在jdk1.6上开发的, 测试了一下在jdk1.5上不能用, 今天重新用jdk1.5编译了一下, 这个是可以支持jdk1.5+的 将 pu-xlscommon-1.0.0.jar 添加到工程的 /lib 目录下 用法在附件中 XlsTest....
jdk1.5新特性[归纳].pdf
jdk1.5 tiger java5 新特性