hey! i have made a List object as follows:

List error = new LinkedList();

and then as per my requirements, i have added strings in it. like error.add(); like this. so, now at some time, i want this list to be empty, so i was doing error=null; which is giving me error of null pointer exception. so please help me how to do this? how can i make this list as empty ?

Recommended Answers

All 3 Replies

Do you mean that you want to remove all of the values in the linklist?

you can use the remove() on all the indexes

Do you mean that you want to remove all of the values in the linklist?

you can use the remove() on all the indexes

ya! ya! i want to remove all the elements from that at one time.. please tell me how to do that...how to use remove ??

Do you mean that you want to remove all of the values in the linklist?

you can use the remove() on all the indexes

ya i got it... thanks. u have solved the thread... :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.