String[] mT={"A","B"};
String[] mT2={"A","BB","C","A","B","C","C","A","D","F","B"};

for(int i=0;i<mT.length;i++)
{
    for(int j=0;j<mT2.length;j++)
    {
        if(mT[i].equals(mT2[j]))
        {
            System.out.println("Equal Values are :"+mT2[j]);
        }
        else
        {
            System.out.println(" Not- Equal Values are :"+mT2[j]);
        }
    }
}

output :

Equal Values are :A
Not- Equal Values are :BB
Not- Equal Values are :C
Equal Values are :A
Not- Equal Values are :B
Not- Equal Values are :C
Not- Equal Values are :C
Equal Values are :A
Not- Equal Values are :D
Not- Equal Values are :F
Not- Equal Values are :B
Not- Equal Values are :A
Not- Equal Values are :BB
Not- Equal Values are :C
Not- Equal Values are :A
Equal Values are :B
Not- Equal Values are :C
Not- Equal Values are :C
Not- Equal Values are :A
Not- Equal Values are :D
Not- Equal Values are :F
Equal Values are :B

i'm getting duplicates values, how can i avoid the duplicates for not-equals.. any one help me. thanks in advance.. :)

several ways:
1. don't store duplicate values in the original array.
2. keep a String (or a set or a list or a .... )
if you reach the else block, check if that String(/set/list/...) already contains the letter. if it does, skip the rest. otherwise, print it and add it to the String(/set/list).
do remember to clean the String(/set/list) for each new iteration

Thanks for your reply... i tried this way

ArrayList<String> array =  new ArrayList<String>();
    for(int i=0;i<mT.length;i++)
    {
        for(int j=0;j<mT2.length;j++)
        {
            if(mT[i].equals(mT2[j]))
            {
                System.out.println("Equal Values are :"+mT2[j]);
            }
            else
            {

                 if(!array.contains(mT2[j]))
                     array.add(mT2[j]); 

            }
        }
    }

**output : **
Equal Values are :A
Equal Values are :A
Equal Values are :A
Equal Values are :B
Equal Values are :B
not equals : [BB, C, B, D, F, A]

Is that what you were looking for?

indeed, without clearing the array it works as well. but if you need a complete print for both A and B (having the complete list of non-equals for each seperately) you'll need to clear the array after your inner loop runs.
if just the one line as you have it is enough, this should be sufficient

Thanks for your reply.. i got it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.