int count=0;
Do {
if (! (I + ""). The contains (" 4")) {
count++;
}
I++;
} while (I & lt; 500);
System. The out. Println (count);
}
CodePudding user response:
I do not contain 4, count++I + "" role: an int to a String
The contains, judge whether still have the substring of a string
CodePudding user response:
I do not contain 4That is to say the Numbers 0-499, does not contain the number of 4
For example: the number 499, contains 4, will not perform count++
CodePudding user response:
The meaning of the red part is: I don't have 4I + "" : a digital I to string type
That is to say the Numbers 0-499, does not contain the number of 4
For example: the number 499, contains 4, will not perform count++
CodePudding user response:
Is focused on the contains, this method returns a Boolean, used to determine whether the front in the string of string containing a given parameter, so that you understand that the front is in spelling a string, and judge whether spell good string containing the characters, "4"