TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Simple Linked List Program in Java
Alagunila Meganathan
Aug 03
2016
Code
405
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
LinkedListDemo.rar
import
java.util.*;
public
class
LinkedListDemo{
public
static
void
main(String[] args){
LinkedList link=
new
LinkedList();
link.add(
"a"
);
link.add(
"b"
);
link.add(
new
Integer(
10
));
System.out.println(
"The contents of array is"
+ link);
System.out.println(
"The size of an linkedlist is"
+ link.size());
link.addFirst(
new
Integer(
20
));
System.out.println(
"The contents of array is"
+ link);
System.out.println(
"The size of an linkedlist is"
+ link.size());
link.addLast(
"c"
);
System.out.println(
"The contents of array is"
+ link);
System.out.println(
"The size of an linkedlist is"
+ link.size());
link.add(
2
,
"j"
);
System.out.println(
"The contents of array is"
+ link);
System.out.println(
"The size of an linkedlist is"
+ link.size());
link.add(
1
,
"t"
);
System.out.println(
"The contents of array is"
+ link);
System.out.println(
"The size of an linkedlist is"
+ link.size());
link.remove(
3
);
System.out.println(
"The contents of array is"
+ link);
System.out.println(
"The size of an linkedlist is"
+ link.size());
}
}
Java
Linked List