ive created an array list but every time i try and print the conents, instead of giving me a list it gives me the class name followed by @e41bc3 random numbers and letter.
any ideas on how to print the contents?

Do it with and without toString() method

import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) {
        List<Any> list = new ArrayList<Any>();
        list.add(new Any(1));
        list.add(new Any(2));

class Any {

    private final int i;

    public Any(int i) {
        this.i = i;

    public String toString() {
        return "Any: " + i;

You get this out put when you try to use th toArray function on the ArrayList instance not the toString :
Lets give ame examples:

    //It is supposed that the ArrayList holds the Integer type
    List<Integer> array =new ArrayList<Integer>();

The output will shows some thing like


Where 3e25a5 is the momery adresss of the array object

But using this

   List<Integer> array =new ArrayList<Integer>();

Will shows [123]

Hope it helps.