[英]Java organize subclasses into different folders
My problem is with Eclipse, something that seems super simple but I just don't know enough to figure out how to do it. 我的问题是使用Eclipse,这看起来非常简单,但我只是不知道该怎么做。 I want to put the subclasses of the objects I have created into folders in the default package to organize them so I don't have dozens of objects jumbled together, but when I create a new folder in the Package Explorer and drop them in, they no longer connect to the superclasses.
我想将创建的对象的子类放入默认程序包的文件夹中进行组织,这样就不会有很多对象混杂在一起,但是当我在程序包资源管理器中创建一个新文件夹并将其放入时,它们不再连接到超类。 How do I connect them?
如何连接它们?
Create packages to organize your classes not folders. 创建包来组织您的课程, 而不是文件夹。
Folders are created to store app resources, eg, images and icons. 创建文件夹来存储应用程序资源,例如图像和图标。
Right-click on your project's src
node in the Package Explorer, then New -> Other -> Package
. 在Package Explorer中,右键单击项目的
src
节点,然后单击src
New -> Other -> Package
。
Having created your packages and moved your classes under them, you should then organize the imports. 创建了程序包并在其下移动了类之后,您应该组织导入。
You do this by opening each class file and hitting the key combination Ctrl+Shift+O
. 为此,请打开每个类文件,然后按组合键
Ctrl+Shift+O
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.