From 28dc8157b5eae7658f4bebabe577dbd7b02e0e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9?= Date: Fri, 26 Jun 2026 18:08:01 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=BA=D1=82=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Status.java | 3 +++ src/TaskDemo.java | 24 ++++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 src/Status.java diff --git a/src/Status.java b/src/Status.java new file mode 100644 index 0000000..b1f4508 --- /dev/null +++ b/src/Status.java @@ -0,0 +1,3 @@ +enum Status { + SUCCESS, ERROR, WARNING +} \ No newline at end of file diff --git a/src/TaskDemo.java b/src/TaskDemo.java index a135644..12fcbf6 100644 --- a/src/TaskDemo.java +++ b/src/TaskDemo.java @@ -4,16 +4,20 @@ import java.util.Scanner; public class TaskDemo { public static void main(String[] args) { - String[] words = {"код", "Програмирование", "джава"}; - System.out.println(findLongestWorld(words)); + Status[] statuses = new Status[]{Status.SUCCESS, Status.ERROR, Status.WARNING}; + System.out.println(Array(statuses)); + } + + public static int Array(Status[] arr) { + int count = 0; + + for (int i = 0; i < arr.length; i++) { + if (arr[i] == Status.ERROR) { + count++; + } + } + return count; } - public static String findLongestWorld (String[] world) { - String longest = world[0]; - for (int i = 1; i < world.length; i++) { - if (longest.length() < world[i].length()) { - longest = world[i]; - } - } return longest; - } + }