Hi below is an example of 2 classes that I run on BlueJ
test class
test1Code:import java.util.ArrayList;
public class test
{
private ArrayList<String> a;
public test()
{
a = new ArrayList<String>();
}
public void addA(String atest)
{
a.add(atest);
}
public int sizeA()
{
return a.size();
}
public void lista()
{
for(String atest : a)
{
System.out.println(atest);
}
}
}
I can compile test class, create an object,call method "addA" and add some string and then call method "lista" (string in the ArrayList is displayed on the terminal window). But after doing so, when I compile test1 class, create an object, call method "list" which basically call method "lista" from test class; nothing happen. I would like when calling "list" method from test1 that it display the content of a ArrayList. Can anyone help me please???Code:public class test1
{
private test a = new test();
public test1()
{
a.lista();
}
public void list()
{
a.lista();
}
}
