write a java pogram to add elements to linked list using keyboard and display it

write a java pogram to add elements to linked list using keyboard and display it

write a java pogram to add elements to linked list using keyboard and display it

View Answers

January 28, 2011 at 4:21 PM

Hi Friend,

Try this:

import java.util.*;
class LinkedListExample
{
    public static void main(String[] args) 
    {
        LinkedList<String> list=new LinkedList<String>();
        Scanner input=new Scanner(System.in);
        System.out.print("how many elemenst do you want to add: ");
        int num=input.nextInt();
        for(int i=0;i<num;i++){
            System.out.print("Add Element: ");
            String element=input.next();
            list.add(element);
        }
        System.out.println();
        System.out.println("LinkedList elements are: ");
        for(int i=0;i<list.size();i++){
         System.out.println(list.get(i));
        }
    }
}

Thanks









Related Tutorials/Questions & Answers:
write a java pogram to add elements to linked list using keyboard and display it
write a java pogram to add elements to linked list using keyboard and display it  write a java pogram to add elements to linked list using keyboard and display
stack using linked list
stack using linked list  how to implement stack using linked list
Advertisements
Multiplication of two polynomials using linked list in java
Multiplication of two polynomials using linked list in java  I am doing a program "Multiplication of two polynomials using linked list in java... for polynomial linked list import java.util.Scanner; class Node { public int
Write a MoveFirst() for Circular Linked List
Write a MoveFirst() for Circular Linked List  write a MoveFirst(T elt) method to point the head at that element. Then the tail would point to the element before that one. so if i have " one two three four) and the moveFirst(two
linked list
linked list   how to write a program using a linked list, that will prompt a user to enter 10 names and display them in reverse   import...); System.out.println("Add elements to LinkedList: "); LinkedList<String> list=new
How to create a Student data base using Linked List in java
How to create a Student data base using Linked List in java  I want a program by using linked list in java. The data stored must... Record2 sandhya 22 5apr By using linked list I hve
How to Display Duplicate elements from more than one List in java?
How to Display Duplicate elements from more than one List in java?  How to Display Duplicate elements from more than one List in java? //I mean common elements from two List? Ex: List a1=new ArrayList(); a1.add(50
Write a java program to display the season given the month using switch case
Write a java program to display the season given the month using switch case  Write a java program to display the season given the month using switch case
write a program to remove the element from hashset using keyboard.
write a program to remove the element from hashset using keyboard.  write a program to remove the element from hashset using keyboard
Linked List
? to ?66?. The segment should also display the new contents of the linked list. ii. Write a program segment to copy all ?Dell? computers to a new linked list... in the following logical linked list represents Computer Number. 76(head) 98 54
java linked list urgent !!!
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent!!!
java linked list urgent!!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
Core java linked list example
Core java linked list example  What is the real time example for linked list
linked list
number of students register each semester. You are required to write a Java program to manage the registration details for the institute. 1. Use a linked list to manage the details of all registered students. a. Create your own linked list
Linked list
Linked list  what is difference btw linked list in datastructure and linked list in java
Write a query to display a row using index
Write a query to display a row using index  Write a query to display a row using index
java list program for common elements
java list program for common elements  hi I want program using java collections list which takes two array list elements and display common elements in both the list as an output   Please visit the following link
Queue implementation using linked list.
Description: The advantage of using linked list is that there is no size limit. The size of queue grow and shrink as per insertion and deletion takes place. Code: # include <stdio.h> # include <stdlib.h> struct node
linked list
linked list  program for single linked list
java pogram
java pogram   i am requesting to admin please send me the code in which i can check the email address that is it in 4 octit and octit value lie between 0 to 255 my email
linked list
://www.roseindia.net/java/beginners/linked-list-demo.shtml...linked list  Hi i have a problem with linked list ! how and where i can use linked list? please give me some example.   Please visit
how to display duplicate elements with out using collection Frame work?
how to display duplicate elements with out using collection Frame work?  how to display duplicate elements with out using collection Frame work
linked list in java - Java Beginners
linked list in java  Hi, how to implement linked list in java using... information. http://www.roseindia.net/java/beginners/linked-list-demo.shtml...(); for (int i = 0; i < N; i++) { // look up a value in the list // using
linked list
linked list   how to add student and mark and number from file in linked list and print them also how to make search function plz can help me sooon
linked list example problem - Java Beginners
by repeatedly using your add function to populate a new instance of your linked list...linked list example problem  Q: Create your own linked list (do..., elem1, elem2, â?¦, elemN] Test your linked list in a main method which
linked list example problem - Java Beginners
by repeatedly using your add function to populate a new instance of your linked list...linked list example problem  Q: Create your own linked list (do..., elem1, elem2, â?¦, elemN] Test your linked list in a main method which
linked list
linked list  hi i have basal problem what is the linked list
delete a node from singly linked list in java
delete a node from singly linked list in java  Write a program(in java), if given a pointer to a node (not the tail node) in a singly linked list, delete that node from the linked list.   could you tell your question
write a program to create an arraylist with string(add,remove) operation.and value should be enter through keyboard.
write a program to create an arraylist with string(add,remove) operation.and value should be enter through keyboard.  write a program to create an arraylist with string(add,remove) operation.and value should be enter through
write a program to create an vector with string(add,remove) operation.and value should be enter through keyboard.
write a program to create an vector with string(add,remove) operation.and value should be enter through keyboard.  write a program to create an vector with string(add,remove) operation.and value should be enter through keyboard
write a program to create an arraylist with string(add,remove) operation.and value should be enter through keyboard.
write a program to create an arraylist with string(add,remove) operation.and value should be enter through keyboard.  write a program to create an arraylist with string(add,remove) operation.and value should be enter through
Display Different Elements from two ArrayLists in Java
Display Different Elements from two ArrayLists Java In this section, we... an object of HashSet class and add all the list elements to it. After that we... that are present in list a2, and vice versa then add those elements to another
Write an applet to display scrolling image in an applet window using thread.
Write an applet to display scrolling image in an applet window using thread.  Write an applet to display scrolling image in an applet window using thread
creating java linked list - Java Beginners
creating java linked list  how can one create a sorted linked list...("Size of list: " + queue.size()); System.out.println("Queue head using peek : " + queue.peek()); System.out.println("Queue head using element
about linked list
about linked list   hey can u help me soon ?? i want to add student,mark,and id from keyboard i want to calculte the number of students pass if his... in linked list   import java.util.*; class StudentData{ int id
HELP Generic linked list
HELP Generic linked list  How to create Generic linked list example program in Java
write a programm using java
write a programm using java  print the following using java programming
Linked list implementation
Linked list implementation  How to create linkedlist by using array in java? and also How to manipulate
Linked List Example In Java
[]) { LinkedList list = new LinkedList(); // add elements to the linked list...Linked List Example In Java LikedList implements List interface which... list. LinkedList(Collection c) : Create a linked list which initialize
Explain Linked List
Explain Linked List   hello, What is Linked List ?   hello,ADS_TO_REPLACE_1 Linked List is one of the fundamental data structures. It consists of a sequence of nodes, each containing arbitrary data fields pointing
How to display windows virtual keyboard
How to display windows virtual keyboard  Hi, I have a jsp file which contains my website design. In my jsp website design, there's a button. I need to display windows virtual keyboard when i press the button. how to do
How to read bytes from a Linked list - Java Beginners
How to read bytes from a Linked list  i have stored byte array into a linked list. How to read the bytearray dta byte after byte from a linked list.Thanking u in advance Sameer
List In Java
structure is implemented in Java using List interface. List interface allows... elements to the list. list.add("Java"); list.add(".Net"); list.add("C...List In Java In this section we will read about the List data structure
Display list of files from a directory using Java
Display list of files from a directory using Java In this section, you will learn how to display the list of files of a particular directory or a sub...() method display the list of file names of that directory and if it is having any
virtual onscreen keyboard project using java and swings - Swing AWT
virtual onscreen keyboard project using java and swings  sir thanks a lot for ur reply for my last question, can u please send me the entire project code of virtual on screen keyboard.i did but im not sure as it was right
Java App - Add, Delete, Reorder elements of the buttons
Java App - Add, Delete, Reorder elements of the buttons  Hello, I'm developing a Java application. I created this interface with MockupScreens... elements as he needs. He can edit element infomrations at any time by clicking

Ads