?
Solved

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

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

What do I do after the comparison line?
Thank you
0
Comment
Question by:coolgem
  • 3
  • 3
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 16751939
How do you want it compared?
0
 

Author Comment

by:coolgem
ID: 16752023
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.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 1000 total points
ID: 16752045
>>If the current date is different from the  previous start date

In that case,

if (comparison != 0) {
}
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:coolgem
ID: 16752063
ok thank you again cg
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16752088
:-)

>>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:

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Comparable.html#compareTo(T)
0
 
LVL 3

Expert Comment

by:Kanti
ID: 16752096
0
 

Author Comment

by:coolgem
ID: 16752221
thank you also Kanti
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month16 days, 1 hour left to enroll

850 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