锘??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("");
}
}
}
]]> - 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爜灝辮浜嗭紝鎴戞兂涓嶄細(xì)姣擟瑕佸鏉傘?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喅錛屼笉榪囨槸涓涓棤闄愬驚鐜殑緇撴灉銆傛垜鏈潵鎯寵涓嬮潰鐨勭粨鏋滐紝鍦–閲岄潰鍋氬緢瀹規(guī)槗錛屽湪JAVA閲岄潰涓嶇煡閬撴庝箞寮勩?
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
...........................
]]> - 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];鏀規(guī)垚triarray[i]=new int[i+1];
浣嗘槸榪欐槸涓棤闄愬驚鐜紝鍥犱負(fù)
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)
寮傚父錛屾槸鍥犱負(fù)鍦ㄧ涓涓猣or寰幆閲岋紝浣犲彧鍒濆鍖栦簡triarray[0],triarray[2],...
triarray[1],triarray[3]閮借繕娌℃湁琚垵濮嬪寲錛屽綋鐒朵細(xì)鏈塏ullPointerException銆?br>

]]>
主站蜘蛛池模板:
郎溪县|
育儿|
什邡市|
牡丹江市|
安达市|
梁河县|
太仆寺旗|
元江|
信阳市|
天柱县|
河西区|
黄浦区|
来凤县|
自治县|
中宁县|
额济纳旗|
香港
|
奉贤区|
漾濞|
平顺县|
乐平市|
汾西县|
壶关县|
武定县|
连州市|
松阳县|
大宁县|
湘潭县|
彭水|
保康县|
花莲县|
溆浦县|
萝北县|
铜梁县|
界首市|
雅安市|
唐海县|
洛阳市|
阳东县|
大理市|
石棉县|