Java: After comparing how to get the record(s) I need?

Posted on 2006-05-24
Last Modified: 2010-03-31
Hi if the date from an sql is different then Inhow do I get it?
this is what I have so far(up to this point):
while ( {
String currentDate = result.getString("AUTH_START_DTM");
if (prevStartDate != null) {
int comparison = prevStartDate.compareTo(currentDate);
prevStartDate = currentDate;
ReleaseAuth releas = new ReleaseAuth();

What do I do after the comparison line?
Thank you
Question by:coolgem
    LVL 86

    Expert Comment

    How do you want it compared?

    Author Comment

    If the current date is different from the  previous start date then I want to make a new ReleasAuth object and then fill in the other fields obtained from the data base.
    I'm confused about that comparison statement where the integer is obtained after the comparison.  
    Thank you again.
    LVL 86

    Accepted Solution

    >>If the current date is different from the  previous start date

    In that case,

    if (comparison != 0) {

    Author Comment

    ok thank you again cg
    LVL 86

    Expert Comment


    >>I'm confused about that comparison statement where the integer is obtained after the comparison.  

    That's done per the spec of the Comparable interface:
    LVL 3

    Expert Comment


    Author Comment

    thank you also Kanti

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    tenRun challenge 28 67
    classnotfoundexception 3 28
    bigHeights  challenge 13 43
    nestparen challenge 4 36
    INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now