android - how to replace String array value with another value in java -
string[] arr_infraid; list<string> list_infraid = new arraylist<string>(); arr_infraid = list_infraid.toarray(new string[list_infraid.size()]);
this string array , values in string array getting 1,2,3,4...10
respectively want replace values a,b,c,.....j
respectively , store in string array 1->a,2->b,3->c........10->j
. please tell me how replace getting null pointer exception
when trying got loop , try replace it.
public class main { static string [] string1 = { "1","2", "3","4", "5","6", "7","8", "9","10"}; static arraylist<string> = new arraylist<string>(); public static void main(string[] args) { for(int =0;i<string1.length;i++){ getarray(string1[i]); } system.out.println(as.tostring()); } public static void getarray(string string){ switch (string) { case "2": as.add("a"); break; case "3": as.add("b"); break; case "4": as.add("c"); break; case "5": as.add("d"); break; case "6": as.add("f"); break; case "7": as.add("g"); break; case "8": as.add("h"); break; case "9": as.add("i"); break; case "10": as.add("j"); break; default: break; } } }
Comments
Post a Comment