Results 1 to 2 of 2
  1. #1
    jumpgirl is offline Member
    Join Date
    Mar 2012
    Posts
    18
    Rep Power
    0

    Default Comparing 2D string array with 1D string array

    Basically my problem is that I don't know how to compare these arrays properly. I have this condition and I have no idea why it doesn't go inside my condition. Are there other ways to compare arrays?

    Java Code:
    if(A[i][j+1]==B[x+1])
    	            {	
    	            	x++;
    	                j++;
    	            }

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,728
    Blog Entries
    7
    Rep Power
    21

    Default Re: Comparing 2D string array with 1D string array

    Are you trying to compare Strings for equality? If so, don't use the == operator but use the equals( ... ) method instead. Read the API documentation why.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 1
    Last Post: 02-07-2011, 09:22 PM
  2. Changing a String array into a String?
    By BennyJass in forum New To Java
    Replies: 6
    Last Post: 01-16-2011, 03:42 PM
  3. create a 2d char array from a 1D string array
    By jschmall12 in forum New To Java
    Replies: 1
    Last Post: 04-27-2010, 10:01 PM
  4. Convert Char Array to String Array
    By Mayur in forum New To Java
    Replies: 8
    Last Post: 10-12-2009, 12:41 PM
  5. Replies: 1
    Last Post: 08-03-2007, 11:52 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •