So I have 2 files: M.java, and construct.java.

In construct .java, I have 5 instance variables, and made a constructor to initialize the variables. I have also created an getters, adn setters for each instance variable.

In Main. java, I created an array: construct[] c= {new construct(int1, string1, string2, string3, int2, int3), new construct(int4, string4, string5, string6, int5, int6)};

Now, I want to show int1, when I compare string1, and another variable string, and the tresult is true

It is giving me: "void type not allowed here"

Without seeing the exact code that generates that error messgae it's imposiible to say.

But in general, if you have an array of objects you definitely can access their public getter methods to retrieve the values of their instance variables.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.