Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-24-2008, 02:32 PM
Member
 
Join Date: Apr 2008
Posts: 33
raj reddy can only hope to improve
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
String comparison abhiN New To Java 2 04-09-2008 05:47 AM
Comparison of Strings Cero.Uno New To Java 3 02-11-2008 03:46 AM
Date comparison Rageagainst20 New To Java 0 12-19-2007 07:34 PM
Parsing Dates for Comparison Rageagainst20 New To Java 1 12-19-2007 06:50 AM
String comparison sireesha New To Java 1 12-18-2007 01:16 AM


All times are GMT +3. The time now is 07:55 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org