This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.example; | |
| // Скажите в чем ошибка? | |
| class Solution { | |
| public static void moveRobot(RobotConnectionManager connectionManager, int toX, int toY) throws RobotConnectionException { | |
| for (int i = 0; i < 3; i++) { | |
| try (RobotConnection robot = connectionManager.getConnection()) { | |
| robot.moveRobotTo(toX, toY); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.example; | |
| // Здесь можете сказать в чем именно ошибка? | |
| class Solution { | |
| public static void moveRobot(RobotConnectionManager robotConnectionManager, int toX, int toY) { | |
| RobotConnection robot = null; | |
| boolean isClosed = false; | |
| for (int i = 0; i < 3; i++) { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.example; | |
| //В языке Java массивы имеют фиксированную длину. Для обхода этого ограничения создайте класс DynamicArray, который должен быть обобщенным (generic). | |
| // | |
| // Требования: | |
| // Создайте класс DynamicArray, который должен быть обобщенным (generic). | |
| // В классе DynamicArray должны быть следующие публичные методы: | |
| // void add(T el) - добавляет элемент в массив. При переполнении текущего массива, должен создаваться новый, большего размера | |
| // void remove(int index) - удаляет элемент из массива по указанному индексу. | |
| // T get(int index) - извлекает элемент из массива по указанному индексу. Если метод get вызывается с некорректным индексом (меньше 0 или больше или равно текущей длине массива), ожидается, что метод выбросит исключение ArrayIndexOutOfBoundsException. |