Sorry to Ask this question Again i had found alot in forum.But as of new to java am Excepting with Explanation code i tried in my way but it not working .i tried without any default method the code have to work for this program
Code:
package javatest;
public class Test03sep {
public static void main(String args[])
{
//0 1 2 3
String []val={"amma","senthil","kumar","amma"};
removeduplicate(val);
}
static void removeduplicate(final String []arr)
{
String temp="";
for (int i = 0; i < arr.length; i++)
{
for (int j = i+1; j < arr.length; j++)
{
System.out.print("condition are:");
System.out.println(arr[i]==arr[j]);
if(arr[i]==arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
for (String string : arr) {
System.out.println("string array are==>"+string);
}
}
}
}
output:
condition are:false
condition are:false
condition are:true
string array are==>amma
string array are==>senthil
string array are==>kumar
string array are==>amma
condition are:false
condition are:false
string array are==>amma
string array are==>senthil
string array are==>kumar
string array are==>amma
condition are:false
string array are==>amma
string array are==>senthil
string array are==>kumar
string array are==>amma
string array are==>amma
string array are==>senthil
string array are==>kumar
string array are==>amma
But i am Excepting the output are String array are===>{"amma","senthil","kumar"};
could some one can guide on this please????