This commit is contained in:
2026-10-07 16:55:49 +09:00
parent ac639e64c6
commit 6ae5b150d0

View File

@@ -0,0 +1,38 @@
package mission;
import java.util.Scanner;
public class StringCheck {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
//段階1
String[] a;
a = new String[4];
a[0] = "いまなにしてる?";
a[1] = "何も入力されていません";
a[2] = "投稿文が長すぎます";
a[3] = "↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓";
//段階2
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
System.out.println(str.trim());
//段階3
boolean b1 = str.length() == 0;
boolean b2= str.length() > 140;
System.out.println(b1);
System.out.println(b2);
int n = 140 - str.length();
System.out.println(n);
}
}