
05-12-2008, 04:44 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,338
|
|
Originally Posted by tito84
how does this programme work
can you tell me each code how work plz
First LinkedList is declared and initialized.
LinkedList <Integer> list = new LinkedList<Integer>();
Here you have to define the generic to avoid compiler warnings. Generic is depend on the LinkedList element type. Here it is an Integer. Then populate the linked list. You can do it in different ways.
Just add elements there.
list.add(new Integer(1));
Here actually no need to instantiate a int value. Simply add.
Or you can define the index that where you want to add the element.
list.add(2, new Integer(0));
But you can't skip index there. Then remove element,
Remove the 0th element of the list.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Last edited by Eranga : 05-12-2008 at 04:48 AM.
|