简体   繁体   中英

convert int to string in android?

I want to store 1 to 110 in string array variable, when i tried am getting null pointer exception.

String age[];
for(int i=0;i<=101;i++){
  age[i]=Integer.toString(i);
}

您需要先初始化String-array:

String[] age = new String[110];
String abc = String.valueOf(int);

try this:

String[] age = new String[102];
String.valueOf(int value);

您必须首先创建String数组:

String[] age = new String[111];

由于未初始化,因此出现错误:

String[] age = new String[111];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM