2 xiaorourou945 xiaorourou945 于 2016.04.27 22:13 提问

android数组越界问题。。。

图片说明

8个回答

glydxm
glydxm   2016.04.27 23:11

下一行最后position越界了

xiaorourou945
xiaorourou945 大神,是不是下级数组个数必须大等于上级数组个数
一年多之前 回复
xiaorourou945
xiaorourou945   2016.04.27 22:21

图片说明

CSDNXIAOD
CSDNXIAOD   2016.04.27 22:22

数组越界问题
c++ 数组越界问题
----------------------biu~biu~biu~~~在下问答机器人小D,这是我依靠自己的聪明才智给出的答案,如果不正确,你来咬我啊!

lvzhongdi
lvzhongdi   2016.04.27 22:30

应该是county的数组越界了吧?

xiaorourou945
xiaorourou945 大神帮忙看下吧,下面是数据
一年多之前 回复
xiaorourou945
xiaorourou945   2016.04.27 22:47

//大类选项值
private String[] province = new String[] {"布","膜","纸","贴","高","浆","胶","香","冰","包","导"};
//中类选项值
private String[][] city = new String[][]
{
{ "热风增白无纺布", "滑爽大圆孔无纺布", "拒水无纺布", "热轧无纺布", "热风无纺布", "水刺无纺布", "兰棉T恤无纺布",
"热风蓬松无纺布", "高档自刻花无纺布", "ES热轧拒水无纺布", "滑爽无纺布", "超柔无纺布", "拒水热风无纺布",
"SMS无纺布", "凹凸热风无纺布" ,"ES热风无纺布" },
{ "全新料包膜", "全新料深压纹底膜", "白色离型膜", "黄色离型膜", "绿色安琦离型膜", "红色安琦离型膜", "黄色全新料包膜",
"绿色全新料包膜", "打孔膜", "粉色全新料包膜", "粉色包膜" , "玫红色包膜", "绿色印刷包膜", "紫色包膜", "蓝色包膜",
"紫色印刷包膜", "绿色包膜","蓝色印刷包膜", "丝韵印刷包膜", "印刷包膜", "透气膜", "白色全新料包膜", "黑印全新料包膜",
"双色印刷包膜", "流延膜绿", "流延膜" },
{ "离型纸", "吸水纸", "无尘纸", "白色离型纸", "紫印离型纸", "紫色热风复合无尘纸", "蓝色热风复合无尘纸", "白色卫生纸", "日用印刷离型纸",
"夜用印刷离型纸" ,"卫生纸" },
{ "快易贴" },
{ "高分子", "昊月高分子" },
{ "木浆" },
{ "热溶胶" },
{ "香精" },
{ "冰片" },
{ "流延膜绿包" },
{ "热风导流层" }
};
//小类选项值
private String[][][] county = new String[][][]
{
{
//布
{ "17.5*25g", "15.8*25g", "6.5*25g", "130*20g" },{ "6.5*25g", "8*22g", "9*22g" },{"11*17", "12*17" },
{ "11.5*18g", "16*18g", "17.5*18g", "12.5*18g" },{"11.5*18g", "6.5*28g", "6.5*20g", "8*20g", "8*25g", "4.5*35g" },
{"16.2*30g"},{"2.8*30g"},{"6.3*40g"},{"8*28g"},{"16.5*20g","11.5*20g"}, {"6.5*25g", "7.5*25g", "8*25g"},
{"6.5*25g"},{"13.*25g", "15*25g", "6.5*20g" },{"11*15g","12*15g","12.5*15g"},{"8*39"},{"8*20g"}
},
{
//膜
{"15.8*22g","23*20g","23*22g"," 24.5*20g","31*20g","34*20g","23.5*20g"},{"7.5*20g","9*20g","16.2*20g","15*23g","16.5*20g","12*20g"},
{"178*28g"},{"178*28g"},{"178*28g"},{"178*28g"},{"16*20g","23*22g"," 24.5*22g", "33*22g"},
{"15.8*20g","23*20g"," 24.5*20g","33*20g"},{"8CM细孔*23","11.5*23g","17CM*23"},{" 24.5*22g","23.5*22g"},
{"15.5*22g"},{"15.5*22g"},{"24*22g"},{"23.5*22g"},{"26.5*20g","240*24g"},{"24*22g"},{"23.5*22g"},{"26.5*22g"},
{"31*27g","16.5*27g","15*27g","17.8*27g"}, {"24.5*23","31*23g","16*23g","15*23g","23*23g","16*24g"},
{"8*35g","15*35g","17.5*35g","15*33g","17*35g","17.5*35g","18*35g"},{"24*18g","28.5*18g","33*18g","37.5*18g","37.5*23g"},
{"24*25g","33*25g","17.5*25g"},{"24*25g","28.5*25g","33*25g"},{"17*22g","17.5*22g"},{"18*24g"}
},
{
//纸
{"4.5cm白","5cm白","6cm白","4.5cm日用红","5cm日用红","4.5cm夜用兰","5cm夜用兰","12.9cm白色"},{"6.5*153g","7.2*160g","6.5*180g"},
{"7.3*65g","7.2*80g"},{"7.5*40g","6*40g","6.5*40g","4.5*40g"},{"6cm"},{"6*80g"},{"6*120g"},{"16.5*145g","17.5*145g"},
{"60*40g"},{"60*40g"},{"16.5*14g"}
},
{
//贴
{ "2.8浅绿B型","2.8白色B型","2.8白色A型","2.8粉红B型","2.8蓝色B型","2.8蓝色A型","1.2透明","1.2红色","1.2紫色","A型紫180机","245/B型粉",
"290/B型紫","290/A型紫","350/B型紫","350/A型紫" }
},
{
//高
{ "住友" },{ "WSJ-01" }
},
{
//浆
{"未处理浆416"}
},
{
//胶
{"1079","1836","5255U","5256","HM-817","T178","T178DU","1056","5213","5333"}
},
{
//香
{"柠檬","清凉剂"}
},
{
//冰
{"冰片"}
},
{
//包
{"30*18g"}
},
{
//导
{"5.5*13g"}
}
};

u010539561
u010539561   2016.04.28 09:20

1、position参数表示从:1开始

2、country[][]数组表示从:0开始

3、尝试将position参数减一,问题解决

dongfeng9ge
dongfeng9ge   Ds   Rxr 2016.04.30 15:17

数组越界问题,只要把position减一就好了

baidu_23086307
baidu_23086307   2016.05.03 22:44

数组是从0开始的哦!记得好好看看

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!