开发者

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


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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜