android 结构体内数组怎么使用?帮我诊断这个函数
classdataList{privatedouble[]lats=null;privatedouble[]longs=null;}privatebooleantest2...
class dataList{
private double[] lats =null;
private double[] longs =null;
}
private boolean test2(){
dataList dl=new dataList();
System.out.println("AAAAAAAAAAAAAAAAAAAAAA1"); //output
for(int i=0;i<10;i++){
dl.lats[i] = new Double("36.123");//怀疑是这句赋值原因
dl.longs[i] = new Double("36.456");
}
System.out.println(dl.lats[0]); //not output
System.out.println("BBBBBBBBBBBBBBBBBBBBBB2"); //not output
return true;
}
无错误,后两句无输出?
为何 展开
private double[] lats =null;
private double[] longs =null;
}
private boolean test2(){
dataList dl=new dataList();
System.out.println("AAAAAAAAAAAAAAAAAAAAAA1"); //output
for(int i=0;i<10;i++){
dl.lats[i] = new Double("36.123");//怀疑是这句赋值原因
dl.longs[i] = new Double("36.456");
}
System.out.println(dl.lats[0]); //not output
System.out.println("BBBBBBBBBBBBBBBBBBBBBB2"); //not output
return true;
}
无错误,后两句无输出?
为何 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询