I'm doing past paper for exam
public static void triangleTest( int a, int b, int c)
{
if ( a > 0 & b > 0 & c > 0 )
{
if ( a==b || b==c );
{
System.out.println("Equilateral");
}
else if ( a==b || a==c || b!=c )
System.out.println("Scalene");
}
else if ( a+b>c && a+c>b || b+c>a );
{
System.out.println(Isoceles);
}
}
else
{
System.out.println("");
}
}
I have been given this code and told to find mistakes, and when i checked the answers
if ( a > 0 & b > 0 & c > 0 )
this has been identified as mistake and &&
were meant to be used instead of &
I ran the code and it worked fine with &
, so my question would be what's what's the reasoning behind this?