My list impl:
public class TestMyList implements List{
int index=0;
int size;
Object [] element;
public TestMyList(){
element=new Object[10];
}
@Override
public boolean add(Object ele) {
element[index++]=ele;
size=index;
return true;
}
}
class which implements my custom list:
public class TestClass {
public static void main(String[] args) {
TestMyList list=new TestMyList();
list.add("hello");
list.add("i am here");
System.out.println(list.size());
System.out.println(list);
}
}
when i run the above program, it displays mypack.TestMyList@2c84d9, instead of [hello, i am here]
please help me in resolving this