Java Tutorial: Linked List with Threads


In this Tutorial You will get to know how easy linkedlist is to use in java.

to create new linked list named name just type.

LinkedList name= new LinkedList()

name.add(“ur content”)l              to add content

refer to following code,

import java.util.*;

public class linkedlist{

public static void main(String argv[])
LinkedList name= new LinkedList();
name.add(1, “bhalchandra”);
System.out.println(“content of name “+name);
name.set(0,” BhUsHaN”);
System.out.println(“content of name after setting  “+name);
String frnd[]={“rohit”,”rohini”,”aanchal”,”ojas”,”chinmoy”};
LinkedList fr=new LinkedList();

for(int i=0;i<5;i++)
fr.add(i, frnd[i]);
System.out.println(“content of frnds “+fr);

for(int i=0;i<5;i++)
System.out.println(fr.get(i)+” removed”);


System.out.println(“content of frnds after removing “+fr);

System.out.println(“this wont print \n No content in fr linkedlist if you want to see how this gives error just comment try&catch”);



same program but includes threading here,



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s