Integer compare(Integer a, Integer b) {
if (a != null && b != null) {
if (!a.equals(b)) {
if (a > b) {
return 1;
} else if (a < b) {
return -1;
}
}
return 0;
} else {
throw new IllegalArgumentException("Arguments must not be null");
}
}
Integer compare(Integer a, Integer b) {
if (a == null || b == null) {
throw new IllegalArgumentException("Arguments must not be null");
}
if (a.equals(b)) return 0;
if (a > b) return 1;
return -1;
}
Integer compare(Integer a, Integer b) {
if (a == null || b == null) {
throw new IllegalArgumentException("Arguments must not be null");
}
if (a.equals(b)) return 0;
return a > b ? 1 : -1;
}
if (b != 0) {
result = a / b;
} else {
throw new IllegalArgumentException("Деление на ноль запрещено");
}
if (b == 0) {
throw new IllegalArgumentException("Деление на ноль запрещено");
}
result = a / b;
while (true) {
// ввод 'a' и 'b'
...
if (a > b) {
System.out.println(a + " > " + b);
} else if (b > a) {
System.out.println(b + " > " + a);
} else {
System.out.println("Числа равны " + a);
break
}
}
while (true) {
// ввод 'a' и 'b'
...
if (a == b) {
System.out.println("Числа равны " + a);
break
}
if (a > b) {
System.out.println(a + " > " + b);
} else if (b > a) {
System.out.println(b + " > " + a);
}
}
if (bookCount < 10) {
...
}
int maxBooksOnShelf = 10;
if (bookCount < maxBooksOnShelf) {
...
}
for (i = 0; i < size - 1; i++) {
if (num % 2 == 0) {
static final int PLAYER_COUNT = 3;
...
for (int i = 0; i < PLAYER_COUNT; i++) {
print("Введите имя игрока: ");