二日目演習_段階1完了いたしました。
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user