Results 1 to 2 of 2
- 04-24-2008, 01:32 PM #1
Member
- Join Date
- Apr 2008
- Posts
- 31
- Rep Power
- 0
count variable is not incrementing for the last comparison of the arrays
Hi
Requirement : count variable should increment upto the last comparison of the arrays.
ie count=1,2,3,4,5....upto last comparison of the arrays like that
and also count variable should be increased if and only if the two arrays values are equal
everything is fine but only the count variable is not incrementing for the last comparison of the arrays
Let us think that there are two arrays al1 and al2;
MY CODE:
al1={1,2,3}
al2=(1,2,3,4,5,6,7,8,9}
int count=0;
for (int i=0;i<al1.size();i++) {
{
for (int j=0;j<al2.size(); j++) {
if(al1.get(i).equals(al2.get(j)))
count++;
}
Actually the count variable should increment for every comparison of the al1 and al2.
MY PROBLEM IS : THe variable is incrementing fine for every comparison , but for the last comparison of the arrays the count variable is not incrementing.
can u validate the count variable such a way that i have to get the last comparison value of the two arrays.
- 05-29-2008, 06:36 PM #2
I tried looking at this but you are missing the instantiation of al1 and al2. Can you please add more code so I can at least copy this and have it compile?
Would be glad to help you if you put in the enough code so that I can compile it. I do not want to guess what type of object al1 and al2 are.
thx
Similar Threads
-
String comparison
By abhiN in forum New To JavaReplies: 2Last Post: 04-09-2008, 04:47 AM -
Comparison of Strings
By Cero.Uno in forum New To JavaReplies: 3Last Post: 02-11-2008, 02:46 AM -
Date comparison
By Rageagainst20 in forum New To JavaReplies: 0Last Post: 12-19-2007, 06:34 PM -
Parsing Dates for Comparison
By Rageagainst20 in forum New To JavaReplies: 1Last Post: 12-19-2007, 05:50 AM -
String comparison
By sireesha in forum New To JavaReplies: 1Last Post: 12-18-2007, 12:16 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks