Results 1 to 2 of 2
  1. #1
    fluteattack is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Default Comparing elements of an array

    We are to code two sets of integers (equal sizes) and find the union, intersect, and complement of the two sets.

    I can't find anything in our text that deals with comparing elements of an array and displaying the results. I'm very new to working with arrays (very new to Java in fact). Where should I start with this problem?

    Thanks for your help.

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

    Default

    Quote Originally Posted by fluteattack View Post
    We are to code two sets of integers (equal sizes) and find the union, intersect, and complement of the two sets.

    I can't find anything in our text that deals with comparing elements of an array and displaying the results. I'm very new to working with arrays (very new to Java in fact). Where should I start with this problem?
    If 'a' is an array of ints then a[j] is an int (the j-th element of the array); j can be any other int used as an index in the array. Do you really have to work with arrays? Arrays are so 1960s Fortanesque ... have a look at ArrayLists or even Sets.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Searching and comparing Array elements
    By jmanswrd in forum New To Java
    Replies: 5
    Last Post: 02-15-2011, 06:06 AM
  2. Trouble comparing Elements while using Generics
    By ryuzog in forum New To Java
    Replies: 13
    Last Post: 12-16-2010, 09:26 AM
  3. comparing elements in array
    By garyscott101 in forum New To Java
    Replies: 14
    Last Post: 12-10-2008, 03:01 PM
  4. comparing array elements
    By Jeremy720 in forum New To Java
    Replies: 2
    Last Post: 10-13-2008, 02:33 AM
  5. comparing array using character
    By Anseki in forum New To Java
    Replies: 7
    Last Post: 10-03-2008, 07:28 PM

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
  •