Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Interview-Questions write a java pogram to add elements to linked list using keyboard and display it
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


vikas
write a java pogram to add elements to linked list using keyboard and display it
1 Answer(s)      3 years and 11 months ago
Posted in : Java Interview Questions


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


Advertisement
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
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
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
Core java linked list example
Core java linked list example  What is the real time example for linked list
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 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 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  what is difference btw linked list in datastructure and linked list in java
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
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  program for single linked list
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
://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
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
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
linked list
linked list  hi i have basal problem what is the linked list
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
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
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 implementation
Linked list implementation  How to create linkedlist by using array in java? and also How to manipulate
Advertisements
 

 

 

DMCA.com