From b82f58d4f3b72ad7d4d9b798ef1380f6384b9087 Mon Sep 17 00:00:00 2001 From: a-takayama <26-a-takayama-scm@it-college.co.jp> Date: Wed, 9 Sep 2026 15:27:53 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E6=97=A5=E7=9B=AE=E6=BC=94=E7=BF=92?= =?UTF-8?q?=5F=E6=AE=B5=E9=9A=8E1=E5=AE=8C=E4=BA=86=E3=81=84=E3=81=9F?= =?UTF-8?q?=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Java_project/src/StringCheck.java | 53 +++++++++++++++++++------------ 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/Java_project/src/StringCheck.java b/Java_project/src/StringCheck.java index 173a6c5..9f38f14 100644 --- a/Java_project/src/StringCheck.java +++ b/Java_project/src/StringCheck.java @@ -3,29 +3,42 @@ import java.util.Scanner; public class StringCheck { public static void main(String[] args) { - - - - String[] ClassNames = new String[4]; - ClassNames[0] = "いまなにしてる?"; - ClassNames[1] = "何も入力されていません"; - ClassNames[2] = "投稿文が長すぎます"; - ClassNames[3] = "↓↓↓↓↓↓投稿されました↓↓↓↓↓↓"; - - System.out.println(ClassNames[0]); - System.out.println(ClassNames[1]); - System.out.println(ClassNames[2]); - System.out.println(ClassNames[3]); - - - - Scanner sc = new Scanner(System.in); - String str = sc.nextLine().strip(); - System.out.println(str); + int counter = 1; + while(counter <= counter++) { + + String[] comment = new String[4]; + comment[0] = "いまなにしてる?"; + comment[1] = "何も入力されていません"; + comment[2] = "投稿文が長すぎます"; + comment[3] = "↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓"; + + //for(int i = 0; i < comment.length; i++) { + // System.out.println((i+1) + "番目:" + comment[i]); + //} + + + System.out.println(comment[0]); + Scanner scanner = new Scanner(System.in); + String text = scanner.next(); + String str = text.strip(); + System.out.println("\n" + comment[3]); + System.out.println(str); + + boolean isEmpty = str.isEmpty(); + System.out.println(isEmpty); + + int strLength = str.length(); + System.out.println(strLength + "文字"); + + boolean isRange = strLength > 140; + System.out.println(isRange); + + System.out.println(140 - str.length()); - + } } +}