简体   繁体   English

Java将子类组织到不同的文件夹中

[英]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.

相关问题 如何在netbeans中组织不同的Java源文件夹(以进行测试)? - How to organize different java source folders in netbeans (for testing)? Java多个子类,但类型不同 - Java Multiple subclasses, but different types 如何将大量的Stringtemplate文件组织到不同的文件夹中 - How can I organize a large number of Stringtemplate files into different folders Java Object 具有不同类型的子类,包括枚举 - Java Object with subclasses of different type including enum Java-包含一组相同超类的不同子类的数据结构 - Java - data structure to contain a set of different subclasses of the same superclass Java - 概括不同的类,类似的方法(不改变子类?) - Java - Generalize different classes, similar methods (without changing the subclasses?) 具有不同原始数据成员但方法相同的Java子类 - Java Subclasses that have different primitive data members, but same methods 我们可以在 Java trustStore 中的逻辑文件夹结构中组织每个具有多个子项的证书链吗 - Can we organize each certificate chain with multiple children in logical folders structure in the Java trustStore 同一属性的不同子类 - Different subclasses for same attribute 不同子类中的相同实现 - Same implementation in different subclasses
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM