I have split the list of strings by "," and then checked the charAt 0==1 and charAt 0==2 then equilateral triangle....so on, but i am getting none of these for all, while debugging i can see the charAt 0 and charAt 1 are equal bt the entire evaluation is false.
public static void main(String[] args) {
List<String> triangleToy=Arrays.asList("36 36 36","3 3 3","2 4 2");
List<String> toRet= new ArrayList<String>();
// TODO Auto-generated method stub
for (String s : triangleToy) {
String[] index=s.split(" ");
if((index[0]==(index[1]))&&(index[0]==(index[2]))){
toRet.add("Equilateral");
}
else if(index[0]==(index[1])){
toRet.add("Isosceles");
}
else{
toRet.add("None of these");
}
}
System.out.println(toRet);
}
}
Please explain me whats going on here...