public ArrayList/*<type>*/ methodName(/* parameters */)
{
ArrayList arraylist = new ArrayList();
/**
* code here
*/
return arraylist;
}
/**
* or
*/
public ArrayList arrayList = new ArrayList();
public ArrayList/*<type>*/ method2Name(/* parameters */)
{
return arrayList;
}
You should read up on returning something. If you are using a method, the second word typed is what is returned. Void means it returns nothing, boolean means you have to return a boolean. int means you have to return an int and so on. It can be done with any object you create. Try experimenting with methods that return something. For instance, in ArrayList, the size() method returns an int of how long the ArrayList is.
What is returned is completely up to you and the purposes of the method you are writing.