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 does system out println () do?

559


What are the restrictions imposed on method overriding?

554


Why java is not 100% object-oriented?

833


What is the requirement of thread in java?

616


How many inner classes can a class have?

580






What is the difference between the prefix and postfix forms of the ++ operator?

554


What is size of int in java?

544


Why spring singleton is not thread safe?

566


Describe how to implement singleton design pattern in struts.

535


What is core java used for?

515


What about main thread in java?

648


What is finalize method?

580


What is oop principle in java?

546


What is better - 'bit-shift a value' or 'multiply by 2'?

701


What are different data structures in java?

534