Java 如何制作默认包eclipse

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24580554/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 13:11:42  来源:igfitidea点击:

How to make a default package eclipse

javaeclipse

提问by EmptyStuff

I am very new to java and when I create a project, it makes the src and the JRE System Library. What it doesn't create is a default package. When i make a class in the src it names it after the project. it requires me to put package (name of project). I don't want to. How do i make the defaultenter image description herepackage.

我对 java 很陌生,当我创建一个项目时,它会生成 src 和 JRE 系统库。它没有创建的是默认包。当我在 src 中创建一个类时,它以项目命名。它需要我放置包(项目名称)。我不想。我如何制作默认在此处输入图片说明包。

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

采纳答案by Strikeskids

New -> class

新建 -> 类

Delete the package field and name the class whatever you want. Make sure it's in the right project.

删除包字段并根据需要为类命名。确保它在正确的项目中。

If you have a class that is already in the wrong package, simply delete the package name from the top of the file and drag the file in the file viewer to the src folder itself.

如果您的类已经在错误的包中,只需从文件顶部删除包名称,然后将文件查看器中的文件拖到 src 文件夹本身。

what to delete

要删除什么