I have an array in First.java, den Second.java is suppose to collect data and put inside the array in First.java. den I need Third.java to read from the array to see wad Second.java has entered.
If i use “First test = new First();” I would get a blank array again…so how do i read from Third.java to see what Second.java has put in First.java’s array?
Thanks in advance
Either make the array
static(as per @Jigar’s suggestion – although this is not recommended due to unit testing and concurrency issues), or preferably pass the proper instance ofFirsttoThird. E.g.Alternatively, you may prefer passing only the array itself, instead of the full
Firstobject, to reduce dependencies: