Question
import java.util.*;
class Collection_Algos
{
public static void main(String args[])
{
LinkedList list = new LinkedList();
list.add(new Integer(2));
list.add(new Integer(8));
list.add(new Integer(5));
list.add(new Integer(1));
Iterator i = list.iterator();
Collections.reverse(list);
Collections.sort(list);
while(i.hasNext())
System.out.print(i.next() + " ");
}
}
a.
2 8 5 1
b.
1 5 8 2
c.
1 2 5 8
d.
2 1 8 5
Posted under Java Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. Which class is used to generate random number?
View solution
Q. Which method is used to generate boolean random values in java?
View solution
Q. What is the return type of Math.random() method?
View solution
Q. Random is a final class?
View solution
Q. What is the range of numbers returned by Math.random() method?
View solution
Q. How many bits are used for generating random numbers?
View solution
Q. What would be the output of following code snippet?
int a = random.nextInt(15) + 1;
View solution
Q. What would be the output of following code snippet?
int a = random.nextInt(7) + 4;
View solution
Q. Math.random() guarantees uniqueness?
View solution
Q. What is the signature of Math.random() method?
View solution
Q. Which of these class produce objects with respect to geographical locations?
View solution
Q. Which of these methods is not a Locale class?
View solution
Q. Which of these class can generate pseudorandom numbers?
View solution
Q. Which of these method of Locale class can be used to obtain country of operation?
View solution
Q. Which of these is a method can generate a boolean output?
View solution
Q. What is the use of Observable class?
View solution
Q. Which of these methods is used to notify observer the change in observed object?
View solution
Q. Which of these methods calls update() method?
View solution
Q. Which of these methods is called when observed object has changed?
View solution
Q. Which of these classes can schedule task for execution in future?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!