这个错误是什么意思,怎么看错误

来源:4-15 编程练习

qq_慕斯3385410

2019-03-13 19:10

public class HelloWorld{

public static void main(String[] args){

int num = 999;

int count = 0;

if (num>=0 && num<=999999999) {

    for (count=0;num/=10;count++){

        System.out.println("他是个"+count+"位的数");

    }

}else{

    System.out.println("输入有误!");

}

https://img.mukewang.com/5c88e5210001aed805600186.jpg

??????????????

写回答 关注

4回答

  • 慕娘8331313
    2019-03-16 17:54:16

    它是个

  • 慕神0439174
    2019-03-13 20:22:27

    public class HelloWorld{

        public static void main(String[] args){

            int num = 999;

            int count = 0;

            String numm = String.valueOf(num);

            count = numm.length();

            System.out.println("它是个" + count + "位的数!");

        }

    }


  • 慕神0439174
    2019-03-13 20:20:09

    public class HelloWorld{


        public static void main(String[] args){

            int num = 999;

            int count = 0;

            if (num >= 0 && num <= 999999999){

                while(num != 0){

                    count++;

                    num /= 10;

                }

                System.out.println("它是个" + count + "位的数!");

            }

            else

                System.out.println("输入有误!");

        }

    }

  • 朱启帆
    2019-03-13 20:08:57

    for(;布尔条件;)

    你的代码这个地方的结果是整型,不是布尔型;

Java入门第一季(IDEA工具)升级版

0基础萌新入门第一课,从Java环境搭建、工具使用、基础语法开始

1163373 学习 · 17551 问题

查看课程

相似问题