求大佬看看我的有什么問題???
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
for(;count<11;count++){
? ? if(num=0){
? ? ? ? num/=10;
? ? ? ? break;
? ? }
}
System.out.println("它是個"+count+"位數(shù)!");
}
}
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
for(;count<11;count++){
? ? if(num=0){
? ? ? ? num/=10;
? ? ? ? break;
? ? }
}
System.out.println("它是個"+count+"位數(shù)!");
}
}
2018-08-19
舉報
2018-08-19
簡單改了一下,就簡短說一下方便你理解。
for循環(huán)語句,如果你使用了break跳出完全可以不用理會for的循環(huán)條件,讓其成為無限循環(huán)可以更簡潔。
if條件語句后的條件為布爾值“=”為賦值運算 應(yīng)該用比較運算中的“==”比較運算不一一列舉不明白翻翻以前的課。
望采納謝謝!