Results 1 to 2 of 2
  1. #1
    Fotis is offline Member
    Join Date
    May 2012
    Rep Power

    Default Search in array of objects (?)


    I cannot explain my question very well.
    I have an array of objects. Can i perform a search in this?

    Check the following code as example:

    Java Code:
    public class test1 {
        	public static void main (String[] args){
        		test2[] array = new test2[2];
        		for(int i=0;i<2;i++){
    	        array[i]=new test2(); 
        		int a=1, b=2;
        		String c ="c", d = "d";
    	        array[0].insert(a, c);
    	        array[1].insert(b, d);    
    Java Code:
    public class test2 {	
    	    int z;
    	    String y;
        public void insert(int z, String y) { 
            this.z = z; 
            this.y = y; 
    I want check if int 1 (or String b) exists in array[i].
    Is it possible?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Search in array of objects (?)

    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. search from array list
    By infernocy in forum New To Java
    Replies: 14
    Last Post: 04-14-2012, 03:50 PM
  2. How to convert array of Objects into array of Strings
    By elenora in forum Advanced Java
    Replies: 1
    Last Post: 06-10-2011, 03:48 PM
  3. Help ! Read from txt to array an than search
    By kram54 in forum New To Java
    Replies: 1
    Last Post: 12-08-2010, 11:52 PM
  4. Search in the array
    By ŖΫ ỏ Ңόρę in forum New To Java
    Replies: 4
    Last Post: 04-28-2010, 08:02 AM
  5. Search through objects
    By MarcusD in forum New To Java
    Replies: 8
    Last Post: 04-14-2009, 05:10 AM

Posting Permissions

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