Hi, I was wondering if any one can help me with returning a array element to the main function. The array list will be the main function. I want to send the array list to a method that adds a element to that list and then send it back to the main function so another method can then receive the array list and print it out. My main problem is how to declare it in the method and how to work it within the method, and returning the array list.
Thanks in advance. GuyOD
btw: I am working with threads.
public class Worker
{
public static void main(String[] args)
{
//how do i declare a arraylist here?
Thread process3 = new Alist(//how do i pass the array to this method?);
process3.start();
}
}
class Alist extends Thread
{
//how do declare it here ?
public void run()
{
//how do i work with just that single element here?
}
//how do i return this element of the arraylist to the main function?
}