?? arraytest1.java
字號:
import java.lang.reflect.*;
/**
* Description:
* <br/>Copyright (C), 2008-2010, Yeeku.H.Lee
* <br/>This program is protected by copyright laws.
* <br/>Program Name:
* <br/>Date:
* @author Yeeku.H.Lee kongyeeku@163.com
* @version 1.0
*/
public class ArrayTest1
{
public static void main(String args[])
{
try
{
//創建一個元素類型為String ,長度為10的數組
Object arr = Array.newInstance(String.class, 10);
//依次為arr數組中index為5、6的元素賦值
Array.set(arr, 5, "Struts2權威指南");
Array.set(arr, 6, "ROR敏捷開發最佳實踐");
//依次取出arr數組中index為5、6的元素的值
Object book1 = Array.get(arr , 5);
Object book2 = Array.get(arr , 6);
//輸出arr數組中index為5、6的元素
System.out.println(book1);
System.out.println(book2);
}
catch (Throwable e)
{
System.err.println(e);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -