Linked List reverese program

Answer Posted / dsr

import java.util.Collections;
import java.util.LinkedList;


public class LikedListDemo {
public static void main(String[] args) {
LinkedList list = new LinkedList();
list.add("Raju");
list.add("Gopal");
list.add("Senthil");
list.add("nagesh");
System.out.println("list size....."+list.size());
System.out.println("list ....."+list);
Collections.reverse(list);
System.out.println("revese list ....."+list);
}
}

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is final, finally, finalize?

803


What is a vector in java?

789


Can we modify the throws clause of the superclass method while overriding it in the subclass?

783


What are the different types of inheritance in java?

767


What do you understand by the bean persistent property?

773


What is the purpose of file class?

763


What do you understand by overloading and overriding in java?

776


How do you create an array in java?

758


What happens if an exception is throws from an object's destructor?

805


Which is better singleton or static class?

708


Is static a keyword in java?

730


Can we declare the static variables and methods in an abstract class?

766


Is it possible for yielded thread to get chance for its execution again ?

781


How variables are stored in memory?

730


Is string is a data type?

749