最简单的做法,给大家参考一下
public class HelloWorld{
public static void main(String[] args){
int num = 9999;
int count = 0;
char ccount;
while(num/10>0){
count+=1;
num=num/10;
}
count+=1;
System.out.println("它是个"+count+"位的数!");
}
}
public class HelloWorld{
public static void main(String[] args){
int num = 9999;
int count = 0;
char ccount;
while(num/10>0){
count+=1;
num=num/10;
}
count+=1;
System.out.println("它是个"+count+"位的数!");
}
}