Help with logical operators

hi everyone I am having trouble getting my logical operators to work correctly, I believe I am making an error somewhere that I cannot find myself. I created a method called "type" where I am trying to determine the type of triangle by comparing side 1, side 2, and side 3. which i shortened to s1, s2 and s3. It seems that even when I enter all three sides the same, it still claims that it is an Isosceles Triangle when it should say that it is a Equilateral Triangle. Any help would be appreciated, thanks.

Code :

public static void type(double s1, double s2, double s3){
if(s1 == s2 || s1 == s3 || s2 == s3){
System.out.println("The triangle is Isosceles since it has two equal length sides.");
}
else if(s1 == s2 && s1 == s3 && s2 == s3){
System.out.println("The triangle is Equilateral since it has equal length on all three sides.");
}
else {
System.out.println("The triangle is Scalene with no equal sides.");
}
}

Re: Help with logical operators

Switch your Isosceles and Equilateral if loops. With the code as it is right now, If the triangle is an Equilateral, the first if loop will find at least 2 sides equal and return true, and you will get the Isosceles message. Check for Equilateral before the Isosceles check.

Re: Help with logical operators