开发者

convert int to string in android?

开发者 https://www.devze.com 2023-04-12 11:56 出处:网络
I want to store 1 to 110in string array variable, when i tried am getting null pointer exception. String age[];

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);
}
开发者_运维百科


You'll need to initialize the String-array first:

String[] age = new String[110];


try this:

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


String abc = String.valueOf(int);


You have to create the String array first:

String[] age = new String[111];


You got error because you haven't initialized it :

String[] age = new String[111];
0

精彩评论

暂无评论...
验证码 换一张
取 消