Вот код,
public class Solution {
public static void main(String[] args) {
compare(5);
}
public static void compare(int a) {
if(a==5)
System.out.println("The number is equal to 5");
if(a<5)
System.out.println("The number is less than 5");
else
System.out.println("The number is greater than 5");
}
}
Вот вывод,
The number is equal to 5
The number is greater than 5
Я только что вызвал метод сравнения один раз, почему он выполняется дважды?