J2SE 新特性.pptVIP

  • 2
  • 0
  • 约 22页
  • 2017-08-09 发布于河南
  • 举报
J2SE 新特性 基于J2SE 5.0 和J2SE 6.0 J2SE 新特性 Enhanced for Loop (增强型循环语句) Autoboxing and Auto-Unboxing of Primitive Types(基本类型的自动拆箱,装箱) Generic Types (泛型) Static Import (静态导入) Formatted Output(格式化输出) Formatted Input(格式化输入) Enumeration 枚举 参数可变方法 Covariant Return Types 协变返回类型 For-each Loop (增强型循环语句) String[] names ={BadBoy, GoodBoy,HappyGirl,sadGirl}; for(String option: names) {  System.out.println(option); } 程序员不必指定集合重元素个数 集合表达式必须为数组或者实现了Iterable接口的类 但如果不希望遍历集合中所有元素则仍需使用传统的循环方式 Autoboxing and Auto-Unboxing of Primitive Types (基本类型的自动拆箱,装箱) 对于像int, boolean,double等基本类型,java5.0中会当放放集合类型中时自动为其装箱成相应的对像

文档评论(0)

1亿VIP精品文档

相关文档