二日目演習_段階1完了いたしました。
This commit is contained in:
@@ -3,29 +3,42 @@ import java.util.Scanner;
|
|||||||
|
|
||||||
public class StringCheck {
|
public class StringCheck {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
int counter = 1;
|
||||||
|
while(counter <= counter++) {
|
||||||
|
|
||||||
String[] ClassNames = new String[4];
|
String[] comment = new String[4];
|
||||||
ClassNames[0] = "いまなにしてる?";
|
comment[0] = "いまなにしてる?";
|
||||||
ClassNames[1] = "何も入力されていません";
|
comment[1] = "何も入力されていません";
|
||||||
ClassNames[2] = "投稿文が長すぎます";
|
comment[2] = "投稿文が長すぎます";
|
||||||
ClassNames[3] = "↓↓↓↓↓↓投稿されました↓↓↓↓↓↓";
|
comment[3] = "↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓";
|
||||||
|
|
||||||
System.out.println(ClassNames[0]);
|
//for(int i = 0; i < comment.length; i++) {
|
||||||
System.out.println(ClassNames[1]);
|
// System.out.println((i+1) + "番目:" + comment[i]);
|
||||||
System.out.println(ClassNames[2]);
|
//}
|
||||||
System.out.println(ClassNames[3]);
|
|
||||||
|
|
||||||
|
System.out.println(comment[0]);
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
Scanner sc = new Scanner(System.in);
|
String text = scanner.next();
|
||||||
String str = sc.nextLine().strip();
|
String str = text.strip();
|
||||||
System.out.println(str);
|
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