Q:

Java Program to insert the element at the specified position

0

Program to insert the element at the specified position

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.util.*;
public class demo1 
{
 public static void main(String[] args)
 {
  LinkedList<String> link_list = new LinkedList<String>();
  link_list.add("C#");
  link_list.add("C++");
  link_list.add("Python");
  link_list.add("Perl");
  link_list.add("Ruby");
  System.out.println("Original linked list:"+ link_list);
  System.out.println("Let add the element at a specific location ");
  link_list.add(2, "Java");
  System.out.println("The linked list:" + link_list); 
 }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now