How to fix “cannot find symbol error” for my program?

前端 未结 2 1737
温柔的废话
温柔的废话 2021-01-26 10:28

I am struggling to find why I keep receiving this message:

Integer.java:13: error: cannot find symbol
         num = Integer.parseInt(numStr);
                           


        
2条回答
  •  猫巷女王i
    2021-01-26 10:43

    You should rename your class to another name, perhaps call it "IntegerMachine" and not "Integer". Java already has a native class with the name "Integer", and by naming your own class the same would mean that instead of calling java.lang.Integer.parseInt(string), which you intended, you are calling .Integer.parseInt(), for which the latter does not exist.

提交回复
热议问题