Java套件

编程入门 行业动态 更新时间:2024-10-14 10:38:01
本文介绍了Java套件-的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何导入名为"poof-support"的软件包.

否,我无法更改软件包名称,我收到一个错误:."预期的 .给出错误的行是:

import poof-support.exception;

解决方案

您的软件包名称中不能包含-.因此,您需要更改名称.

java文档中的某些软件包命名约定
  • 使用小写形式编写软件包名称,以避免与类或接口的名称冲突.

  • 在某些情况下,互联网域名可能不是有效的软件包名称.如果域名中包含连字符或其他特殊字符,或者软件包名称以数字或其他字符开头的Java名称的开头字符是非法的,或者软件包名称包含保留的Java关键字,则可能会发生这种情况例如"int".在这种情况下,建议的约定是添加下划线.例如:

不正确的名称|正确的名字---------------------------------------------------------hyphenated-name.example |org.example.hyphenated_nameexample.int |int_.example123name.example |com.example._123name

检查此链接以了解软件包的命名约定./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 Documentation
  • Package 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:

incorrect names | correct names --------------------------------------------------------- hyphenated-name.example | org.example.hyphenated_name example.int | int_.example 123name.example | com.example._123name

check this link for naming conventions of package.

更多推荐

Java套件

本文发布于:2023-11-17 02:44:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608521.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:套件   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!