如何导入名为"poof-support"的软件包.
否,我无法更改软件包名称,我收到一个错误:."预期的 .给出错误的行是:
import poof-support.exception; 解决方案您的软件包名称中不能包含-.因此,您需要更改名称.
java文档中的某些软件包命名约定-
使用小写形式编写软件包名称,以避免与类或接口的名称冲突.
-
在某些情况下,互联网域名可能不是有效的软件包名称.如果域名中包含连字符或其他特殊字符,或者软件包名称以数字或其他字符开头的Java名称的开头字符是非法的,或者软件包名称包含保留的Java关键字,则可能会发生这种情况例如"int".在这种情况下,建议的约定是添加下划线.例如:
检查此链接以了解软件包的命名约定./p>
How do I import a package named "poof-support" .
No, I can't change the package name, I'm getting an: error '.' expected . The line giving the error is:
import poof-support.exception ;解决方案
You can't have - in your package name. So you will need to change the name.
Some Package Naming Conventions from java DocumentationPackage names are written in all lower case to avoid conflict with the names of classes or interfaces.
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". In this event, the suggested convention is to add an underscore. For example:
check this link for naming conventions of package.
更多推荐
Java套件
发布评论