out.printf("\n%s\n", hangmanInterface.getCurrentImage(imageIndex)); out.printf("Word:…
- User
out.printf("\n%s\n", hangmanInterface.getCurrentImage(imageIndex)); out.printf("Word: %s\n", game.getCurrentWord()); out.printf("Attempts left: %s\n", game.getAttemptsLeft()); out.printf("Used letters: %s\n", game.usedCharacters());
06:26:01 [ERROR] Medium: Format string should use %n rather than \n in backend.academy.service.GameSession.printGameInterface() [backend.academy.service.GameSession] At GameSession.java:[line 146] VA_FORMAT_STRING_USES_NEWLINE 06:26:01 [ERROR] Medium: Format string should use %n rather than \n in backend.academy.service.GameSession.printGameInterface() [backend.academy.service.GameSession] At GameSession.java:[line 144] VA_FORMAT_STRING_USES_NEWLINE 06:26:01 [ERROR] Medium: Format string should use %n rather than \n in backend.academy.service.GameSession.printGameInterface() [backend.academy.service.GameSession] At GameSession.java:[line 143] VA_FORMAT_STRING_USES_NEWLINE 06:26:01 [ERROR] Medium: Format string should use %n rather than \n in backend.academy.service.GameSession.startGameSession() [backend.academy.service.GameSession] At GameSession.java:[line 103] VA_FORMAT_STRING_USES_NEWLINE 06:26:01 [INFO]
- Assistant
The errors you're encountering are related to the use of newline characters (
\n) in the Javaprintffunction. In Java, it is recommended to use the platform-independent line separator (%n) in format strings withprintf. This ensures that your code will work correctly on all operating systems, as different operating systems use different characters for line breaks.To fix these errors, you need to replace each occurrence of
\nin your format strings with%n. Here's an updated version of the code snippet you provided:out.printf("%n%s%n", hangmanInterface.getCurrentImage(imageIndex)); out.printf("Word: %s%n", game.getCurrentWord()); out.printf("Attempts left: %s%n", game.getAttemptsLeft()); out.printf("Used letters: %s%n", game.usedCharacters());In this revised version, each
\nis replaced with%n, which should resolve the errors indicated in your log messages. - User
- Assistant
- User
- Assistant
- User
- Assistant
- User
проставь их цифрами из enum
- Assistant
- User
как в списке оставить только те элементы которые содержатся в другом классе
- Assistant