import java.util.LinkedList; public class exLinkedList{ static LinkedList<String> myLinkedList; public static void main(String[] args){ System.out.println("LinkedList Exerecise"); myLinkedList = new LinkedList<String>(); myLinkedList.add("ABCDEF"); myLinkedList.add("G"); myLinkedList.add("HIJ"); myLinkedList.add("KLM"); myLinkedList.add("NOPQRST"); myLinkedList.add("UVW"); myLinkedList.add("XYZ"); showAll(); System.out.println(); myLinkedList.removeFirst(); myLinkedList.removeLast(); myLinkedList.remove("KLM"); myLinkedList.remove("JAVA"); //Can't found! showAll(); } static void showAll(){ for(int i = 0; i < myLinkedList.size(); i++){ System.out.println(myLinkedList.get(i)); } } }
Java Tutorial, Java Study, Learn Java, Java Lab@home, Java Cycle test, Java Projects, Java Assignments, Java Notes and much more..
Thursday, 20 April 2017
Exercise on LinkedList ~ foundjava
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment