for (char c : str.toCharArray()) {
if (!Character.isDigit(c)) {
return false;
}
}
Dont understand what mean condition of foor loop. How write this part of code in If/else form. Thank you.
for (char c : str.toCharArray()) {
if (!Character.isDigit(c)) {
return false;
}
}
Dont understand what mean condition of foor loop. How write this part of code in If/else form. Thank you.
The code means for each character in the string, if it's not a digit, return false. You can't write it purely in if/else form, as you need a loop to visit each character in the string.