 
		L_inDesign
2020-07-16 10:48
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count=0;
int j=1;
 for(count=0;count<=10;count++){
    if(num>=j){
    j=j*10;
    continue;
    }
    else{
    System.out.println("它是个"+ count +"位数");
    break;
        }
    }
   
 
				额。。。试了一下你的代码,确实这么提示的,可你有没有认真看看他要求输出的字符串是啥,程序毕竟是死的,你输出里面少了个“的”字
 
				public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count=0;
int j=1;
for(int count=0; count<=10; count++){
if(num >= j){
j = j*10;
continue;
}else{
System.out.println("它是个"+ count +"位数");
break;
}
}
看了一会没看懂你的思虑,只能做个小提醒,for中参数要又类型,能说说你定义的 j 用来保存什么吗?
Java入门第一季(IDEA工具)
1168092 学习 · 18754 问题
相似问题