/
cod43
/
home_tasks
Обзор
Документация
Войти
/
cod43
/
home_tasks
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/task3/Task3Main.java
34 строки
1 KB
cod43
first_commit
29 июл 2025, 19:46
29 июл 2025, 19:46
c3aa089
Код
Авторство
О чём код?
package task3; import task2.Student; import java.util.Arrays; public class Task3Main { public static void main(String[] args) { Student alice = new Student("Alice", "Alice"); alice.setGrades(new int[]{2, 3, 3}); Student bob = new Student("Bob", "Bob"); bob.setGrades(new int[]{3, 3, 3}); Student eva = new Student("Eva", "Eva"); eva.setGrades(new int[]{2, 2, 2}); Student[] students = {eva, bob, alice}; System.out.println("Лучшую оценку имеет: " + StudentService.bestStudent(students)); System.out.println("Отсортированный список студентов по фамилии"); StudentService.sortBySurname(students); System.out.println(Arrays.toString(students)); System.out.println("Проверяем корректную обработку граничных случаев"); // Следующие две строки должны выводить null System.out.println(StudentService.bestStudent(null)); System.out.println(StudentService.bestStudent(new Student[]{})); // Следующие две строки не должны выбрасывать исключения StudentService.sortBySurname(null); StudentService.sortBySurname(new Student[]{}); } }