我在idea中重命名包没有遇到麻烦,但是...我有“example”包,我想将其重命名为“enum”,但Idea不允许我这样做。当我创建一个新的包“enum”时,它警告我,我将无法在其中创建任何java类。有什么问题吗???
最佳答案
您不能将包重命名为 enum
,因为它是 Java 中的保留关键字。
在 Oracle 教程页面“Naming a package”上写着
In some cases, the internet domain name may not be a valid package name. This can occur if the domain name contains a hyphen or other special character, if the package name begins with a digit or other character that is illegal to use as the beginning of a Java name, or if the package name contains a reserved Java keyword, such as "int".
关于java - 无法在 Intellij Idea 中重命名包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27168504/