public String(String num){
if (num == null) {
return "N/A";
}
int len = num.length();
int c = 0;
char[] sb = new char[len];
for (int i = 0; i < len; i++) {
sb[c++] = num.charAt(i);
if ((len - 1 - i) % 3 == 0 && i != len - 1) {
sb[c++] = ',';
}
}
return new String(sb);
}
}
This is the code and I can not find why it is giving me that error when compiling
if (num == null) {
return "N/A";
}
int len = num.length();
int c = 0;
char[] sb = new char[len];
for (int i = 0; i < len; i++) {
sb[c++] = num.charAt(i);
if ((len - 1 - i) % 3 == 0 && i != len - 1) {
sb[c++] = ',';
}
}
return new String(sb);
}
}
This is the code and I can not find why it is giving me that error when compiling