Day2 stept 1
This commit is contained in:
25
Exercises/src/Day2/StringCheck.java
Normal file
25
Exercises/src/Day2/StringCheck.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package Day2;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class StringCheck {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String[] messages = { "いまなにしてる", "何も入力されていません", "投稿文が長すぎます", "↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓" };
|
||||
|
||||
Scanner scan = new Scanner(System.in);
|
||||
String str = "";
|
||||
|
||||
// 段階1: 無限ループ化
|
||||
while (true) {
|
||||
System.out.println(messages[0]);
|
||||
str = scan.nextLine().trim();
|
||||
|
||||
System.out.println("あなたの入力は: [" + str + "]");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user