锘??xml version="1.0" encoding="utf-8" standalone="yes"?>在线这里只有精品,欧美精品导航,亚洲久久视频http://www.aygfsteel.com/BK-JAVA/archive/2007/02/25/100489.html#100504鍠滄潵涔愬搱鍝?/dc:creator>鍠滄潵涔愬搱鍝?/author>Sat, 24 Feb 2007 16:38:00 GMThttp://www.aygfsteel.com/BK-JAVA/archive/2007/02/25/100489.html#100504
public static void main(String[] args) {
int[][] triarray = new int[10][];
int i = 0, j = 0;
for (int[] triarray2 : triarray) {
triarray2 = new int[++i];
}

for (int[] triarray2 : triarray) {
System.out.println(triarray2);
}
}



]]>
re: 涓轟粈涔堣繖孌電▼搴忕紪璇戞垚鍔燂紝浣嗚繍琛屾姏鍑哄紓甯革紵http://www.aygfsteel.com/BK-JAVA/archive/2007/02/25/100489.html#100502JIM.WUJIM.WUSat, 24 Feb 2007 16:15:00 GMThttp://www.aygfsteel.com/BK-JAVA/archive/2007/02/25/100489.html#100502鍛靛懙銆傘傘傘傝阿璋紒錛?
閭d箞涓嬮潰鐨勭▼搴忛棶棰樺張鍦ㄥ摢閲屽憿錛燂紵
public class trigon{
public static void main(String[] args){
int[][] triarray=new int[10][];
int i=0,j=0;
for(int[] triarray2:triarray){
triarray2=new int[++i];
}

for(int[] triarray2:triarray){
for(int tri:triarray2){
triarray2[j++]=j+1;
System.out.println(triarray2+"");
}
System.out.println("");
}
}
}

JIM.WU 2007-02-25 00:15 鍙戣〃璇勮
]]>
re: 涓轟粈涔堣繖孌電▼搴忕紪璇戞垚鍔燂紝浣嗚繍琛屾姏鍑哄紓甯革紵http://www.aygfsteel.com/BK-JAVA/archive/2007/02/25/100489.html#100501鍠滄潵涔愬搱鍝?/dc:creator>鍠滄潵涔愬搱鍝?/author>Sat, 24 Feb 2007 16:02:00 GMThttp://www.aygfsteel.com/BK-JAVA/archive/2007/02/25/100489.html#100501
鐢ㄤ笅闈㈢殑浠g爜灝辮浜嗭紝鎴戞兂涓嶄細姣擟瑕佸鏉傘?br>
public static void main(String[] args) {
int[][] triarray = new int[10][];
for (int i = 0; i < triarray.length; i++) {
triarray[i] = new int[i + 1];
}
for (int i = 0, k = 1; i < triarray.length; i++) {
for (int j = 0; j < triarray[i].length; j++) {
triarray[i][j] = k++;
}
}
for (int i = 0; i < triarray.length; i++) {
for (int j = 0; j < triarray[i].length; j++) {
System.out.printf("%2d ", triarray[i][j]);
}
System.out.println();
}
}

]]>
re: 涓轟粈涔堣繖孌電▼搴忕紪璇戞垚鍔燂紝浣嗚繍琛屾姏鍑哄紓甯革紵http://www.aygfsteel.com/BK-JAVA/archive/2007/02/24/100489.html#100500JIM.WUJIM.WUSat, 24 Feb 2007 15:51:00 GMThttp://www.aygfsteel.com/BK-JAVA/archive/2007/02/24/100489.html#100500鍛靛懙銆傘傘傘傝阿璋㈠暒錛屼笉榪嘕DK6.0鏄粯璁ゅ垵濮嬪寲鐨勫惂錛屾垜璇曚簡灝?+i錛屾敼涓篿+1闂瑙e喅錛屼笉榪囨槸涓涓棤闄愬驚鐜殑緇撴灉銆傛垜鏈潵鎯寵涓嬮潰鐨勭粨鏋滐紝鍦–閲岄潰鍋氬緢瀹規槗錛屽湪JAVA閲岄潰涓嶇煡閬撴庝箞寮勩?
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
...........................

JIM.WU 2007-02-24 23:51 鍙戣〃璇勮
]]>
re: 涓轟粈涔堣繖孌電▼搴忕紪璇戞垚鍔燂紝浣嗚繍琛屾姏鍑哄紓甯革紵http://www.aygfsteel.com/BK-JAVA/archive/2007/02/24/100489.html#100493鍠滄潵涔愬搱鍝?/dc:creator>鍠滄潵涔愬搱鍝?/author>Sat, 24 Feb 2007 15:20:00 GMThttp://www.aygfsteel.com/BK-JAVA/archive/2007/02/24/100489.html#100493
public class trigon2{
public static void main(String[] args){
int[][] triarray=new int[10][];
for(int i=0;i<triarray.length;i++){
triarray[i]=new int[++i];
.....

鎶婅繖閲宼riarray[i]=new int[++i];鏀規垚triarray[i]=new int[i+1];


浣嗘槸榪欐槸涓棤闄愬驚鐜紝鍥犱負
for(int i=0;i<triarray.length;i++){
for(int j=0;j<triarray[i].length;j++){
j=0;
triarray[i][j]=++k;
System.out.println(triarray[i][j]);
}
}
鍦ㄥ唴寰幆浣犳瘡嬈″張鎶妀=0, j<triarray[i].length褰撶劧涓鐩存槸true浜嗐?br>
鑷充簬浣犵湅鍒扮殑
//Exception in thread "main" java.lang.NullPointerException
// at trigon2.main(trigon2.java:9)
寮傚父錛屾槸鍥犱負鍦ㄧ涓涓猣or寰幆閲岋紝浣犲彧鍒濆鍖栦簡triarray[0],triarray[2],...
triarray[1],triarray[3]閮借繕娌℃湁琚垵濮嬪寲錛屽綋鐒朵細鏈塏ullPointerException銆?br>




]]>
主站蜘蛛池模板: 布拖县| 连南| 义乌市| 定边县| 浑源县| 革吉县| 敖汉旗| 新巴尔虎右旗| 兰溪市| 高青县| 巴林左旗| 子洲县| 武鸣县| 黔东| 镇安县| 林州市| 沙湾县| 莲花县| 寿阳县| 宁津县| 综艺| 林州市| 新田县| 佛教| 寿阳县| 宜丰县| 长沙市| 松潘县| 毕节市| 乌鲁木齐市| 沂水县| 颍上县| 禹城市| 闸北区| 南乐县| 周宁县| 辽阳县| 色达县| 江都市| 外汇| 年辖:市辖区|