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

How to perform binary search in java?

579


When a thread is executing a synchronized method , then is it possible for the same thread to access other synchronized methods of an object ?

615


What is multi level inheritance in java?

564


What is the purpose of checked and unchecked exceptions in JAVA?

571


How do you control extraneous variables?

512






Explain importance of throws keyword in java?

570


What does math floor () do?

561


How use .contains in java?

626


What is difference between java and java ee?

562


what are synchronized methods and synchronized statements? : Java thread

583


What is the purpose of an interface?

562


What is casting in java programming?

590


Can we use this () and super () in a method?

535


Explain what pure virtual function is?

603


Explain try and catch keywords in java?

625