I need to compare rm.rel object array with agent array and also object array .i dont know how to perform it ? whether i need to store agent and object as some thing like arraylist or hashmap..
here is my code... The rm.rel array consist of values like (mod pur and agt agt and obj obj mod mod mod man agt cob mod obj obj agt man cnt agt)
public String[] agent={"agt","cag","aoj","cao","ptn"};
public String[] object={ "obj", "cob", "opl", "ben"};
public void compare()
{
temp=new String[rm.length];
for(int k=0;k<rm.length;k++)
{
temp[k]=rm[k].rel[k];
}
for(int i=0;i<rm.length;i++)
{
for(int j=0;j<agent.length+object .length;j++)
{
if(temp[i].equals(agent[j]))
{
temp[i]="agent";
}
else if(temp[i].equals(object[j])) // It shows arrayout of bound exception
{
temp[i]=rm[i].rel[i];
}
}
}
for(int k=0;k<temp.length;k++)
{
System.out.println(temp[k]);
}
}
i need to compare each element of rm.rel array with all elements of agent array if it is not equal then it should compare with object array pls help