ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
How  can  you  sort  dates?
 Question Submitted By :: Sarath Kumar Ch
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How can you sort dates?
Answer
# 1
Right now two ways come to my mind.

First: 
       Create a TreeSet, add all the dates to it. They get 
sorted by default since java.util.Date implements 
comparable. Here is an example -->
       Set<Date> sortedDates = new TreeSet<Date>();
       sortedDates.add(new Date());
       Calendar cal = Calendar.getInstance();
       cal.set(2009, 2, 12);
       sortedDates.add(cal.getTime());

Second: 
        We can use the compare method inside Date class 
directly and write our own sorting implementation.
 
Is This Answer Correct ?    5 Yes 1 No
Nitesh
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
What is an Applet ?  2
Difference between Applet & Application?  5
define System.out.println(); what is the meaning!  8
What is the difference between java and .Net? Bosch5
How to set the Heap size in Java ? HCL2
What are the operands of instanceof operator?  2
is memory to the abstract class allocated ..or objects not instantiated TCS4
What are the similarities between an array and an ArrayList?  2
steps to connect with Oracle Databse using TYPE-2 Jdbc driver.  1
what is struts-config-xml?and its use?  3
Q) I have a ArrayList object, in that object i have added 5 integer values, 5 float values, 5 string values. Now question is how can delete particular type of data ( i.e all int values or all float values or string values) in that list object at a time? Aricent2
What is the use of an interface?  3
Define Compiling?  2
what is meant by serialization?  6
What is the default initialized value of String type variable?  3
why marker interfaces are there in java Digital-Group3
what is mean by method signature? Satyam5
How to avoid the runtime exception ?  2
Are nested try statements are possible?  2
Why are the methods of the Math class are static?  1
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com