求JavaSE 5.0的一些新特性(越详细越好)(网上拷贝的不要!!!) 求JavaSE 5.0的一些新特性JavaSE 5.0的很多新特性对与解决许多编程问题有很多帮助,希望能多多的了解.特发此贴!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Java1.5版主要新增了以下新特性:泛型、元数据、枚举、自动装箱和自动拆箱、增强的for-each风格的for循环、变长参数(varargs)、静态导入、格式化I/O、并行工具、对API的升级 public static void test(String ...a) { System.out.println(a.length); } public static void main(String[] args) throws Exception { //a泛型 ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("aa"); String b = arrayList.get(0); //b增强for循环 String []array = new String[]{"a","b","c"}; for(String s:array) { System.out.println(s); } //c可变参数 Test2.test(new String[]{}); //自动装箱,拆箱 Integer a = 12; int i = a;给出几个最常用的简单实现 1、自动装箱和自动拆箱 (int Integer之间的自动转换)2、for循环 for(String s:array) { System.out.println(s); }其他的... 楼主没要求必须是中文,所以我发的是英文(目前好像没有谁去刻意翻译这些),相信lz阅读能力很坚挺。我没有拷贝过来,直接把地址粘过来了,这个是官方解释java SE 5.0的新特性(New Feature)和较之前个版本的增强与提高(Enhancements)。http://download.oracle.com/javase/1.5.0/docs/relnotes/features.html对于我来说新特性泛型、枚举是最常用的,希望楼主有足够的热情看完这篇文档并将自己对这篇文章的理解用母语表述出来,为还打算用5.0的后人铺路。下面这个连接是5.0所有的小版本号较前一小版本所解决修改掉的bug,楼主有兴趣也可以看看。将来有不爱看文档的新人问你小版本号的区别时,你可以很niu x的详细讲给它听。 http://www.oracle.com/technetwork/java/javasebusiness/documentation/index.html 1、foreachpackage org.lxh.arraydemo;public class ForeachArrayDemo01 { public static void main(String args[]) { int t1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; for (int x : t1) { System.out.print(x + "、"); } }}2、可变参数package org.lxh.arraydemo;public class ForeachArrayDemo02 { public static void main(String args[]) { int temp[] = { 2, 4, 6, 8 }; fun(); // 没有参数 fun(1); // 一个参数 fun(1, 3, 5, 7, 9); // 一个参数 fun(temp); } public static void fun(int... arg) { for (int x : arg) { System.out.print(x + "、"); } System.out.println(); }}3、自动装箱和拆箱4、静态导包package org.lxh.staticdaobaodemo01;public class Math { public static int add(int i,int j) { return i + j; }}package org.lxh.staticdaobaodemo02;import static org.lxh.staticdaobaodemo01.Math.*;public class StaticDaoBaoDemo { public static void main(String args[]) { System.out.println(add(1, 1)); }} 什么叫网上拷贝的不要,你就自以为是去吧。CSDN不也是网络资源之一嘛这些问题百度之 谷歌之 XX之 出来问很丢人 做JAVA图形界面遇到了问题,求救!! 关于List的线程安全问题 java都要学什么? 一个超基础的问题 各位大哥来帮小弟看看这个需求吧 关于TimerTask类...请指教!!! 诚心请教一下HTTP的请求信息,服务器端的解析问题~(自己写的浏览器端代码有点问题) 引导scjp的选择题 怎么样求两个数组中不相同元素 【请教】解释一下代码 关于javabean 删除控件,更新,但是没有效果
System.out.println(a.length);
}
public static void main(String[] args) throws Exception {
//a泛型
ArrayList<String> arrayList = new ArrayList<String>();
arrayList.add("aa");
String b = arrayList.get(0);
//b增强for循环
String []array = new String[]{"a","b","c"};
for(String s:array) {
System.out.println(s);
}
//c可变参数
Test2.test(new String[]{});
//自动装箱,拆箱
Integer a = 12;
int i = a;
给出几个最常用的简单实现
2、for循环
for(String s:array) {
System.out.println(s);
}
其他的...
我没有拷贝过来,直接把地址粘过来了,这个是官方解释java SE 5.0的新特性(New Feature)和较之前个版本的增强与提高(Enhancements)。
http://download.oracle.com/javase/1.5.0/docs/relnotes/features.html
对于我来说新特性泛型、枚举是最常用的,希望楼主有足够的热情看完这篇文档并将自己对这篇文章的理解用母语表述出来,为还打算用5.0的后人铺路。
下面这个连接是5.0所有的小版本号较前一小版本所解决修改掉的bug,楼主有兴趣也可以看看。将来有不爱看文档的新人问你小版本号的区别时,你可以很niu x的详细讲给它听。
package org.lxh.arraydemo;public class ForeachArrayDemo01 {
public static void main(String args[]) {
int t1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
for (int x : t1) {
System.out.print(x + "、");
}
}
}
2、可变参数
package org.lxh.arraydemo;public class ForeachArrayDemo02 {
public static void main(String args[]) {
int temp[] = { 2, 4, 6, 8 };
fun(); // 没有参数
fun(1); // 一个参数
fun(1, 3, 5, 7, 9); // 一个参数
fun(temp);
} public static void fun(int... arg) {
for (int x : arg) {
System.out.print(x + "、");
}
System.out.println();
}
}
3、自动装箱和拆箱
4、静态导包
package org.lxh.staticdaobaodemo01;public class Math {
public static int add(int i,int j) {
return i + j;
}
}package org.lxh.staticdaobaodemo02;import static org.lxh.staticdaobaodemo01.Math.*;
public class StaticDaoBaoDemo {
public static void main(String args[]) {
System.out.println(add(1, 1));
}
}