Actually no clue what exactly you wanted to achieve with your code, since several variables are undefinied (dateString
and s
for example). Also is the array m[]
definied in a wrong way (double "
within the data part) – however, I “fixed” your code with the given information:
String[] m = {"01", "02", "03"};
String[] d = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15"};
StringBuilder sb = new StringBuilder();
for (int i = 0; i < m.length; i++) {
for (int j = 0; j < d.length; j++) {
sb.append(m[i] + d[j] + " ");
}
}
System.out.println(sb.toString());
And this does output 0101 0102 0103 0104 0105 0106 0107 0108 0109 0110 0111 0112 0113 0114 0115 0201 0202 0203 0204 0205 0206 0207 0208 0209 0210 0211 0212 0213 0214 0215 0301 0302 0303 0304 0305 0306 0307 0308 0309 0310 0311 0312 0313 0314 0315
solved Null Pointer access: This variable dt_str can only be null