简体   繁体   English

使用来自另一个类的对象创建数组(Java)

[英]Creating an array with objects from another class (Java)

I have created a class Patientjournal which contains a lot of information about various patients in a hospital, as well as methods for retrieving this information. 我创建了一个Patientjournal类,其中包含有关医院中各种患者的大量信息,以及检索此信息的方法。

I have now created another class named Section . 我现在创建了另一个名为Section类。 In this class I wish to create an array of Patientjournal-objects. 在本课程中,我希望创建一个Patientjournal对象数组。 I have tried to to this as follows: 我试着这样做如下:

private Patientjournal[] patientjournals;

However, this yields the error message 但是,这会产生错误消息

"Patientjournal cannot be resolved to a type". “Patientjournal无法解析为某种类型”。

Why am I getting this message? 为什么我收到此消息? I don't understand this, because in the actual class Patientjournal , I have successfully been able to create an array with objects from yet another class using the same procedure, and this time without difficulties. 我不明白这一点,因为在实际的类Patientjournal ,我已经成功地使用相同的过程创建了一个包含来自另一个类的对象的数组,这次没有困难。

If anyone knows what may cause this I will greatly appreciate any help! 如果有人知道可能会导致什么,我将非常感谢任何帮助!

We could use more information, but it sounds like a compiler issue. 我们可以使用更多信息,但这听起来像编译器问题。 Specifically, I'm assuming you don't have the necessary import statement; 具体来说,我假设你没有必要的import声明; import ext.site.Patientjournal or whatever. import ext.site.Patientjournal或者其他什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM