ループ構文のウォームアップと、正常系フローのループ化
This commit is contained in:
@@ -8,19 +8,21 @@ public class StringCheck {
|
||||
};
|
||||
|
||||
int maxChar = 140;
|
||||
|
||||
System.out.println(defaultMessage[0]);
|
||||
// for (String mes : defaultMessage) {
|
||||
// System.out.println(mes);
|
||||
// }
|
||||
|
||||
//スキャナーの準備
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
while (true) {
|
||||
System.out.println(defaultMessage[0]);
|
||||
|
||||
// 入力処理を行う
|
||||
String str = scanner.nextLine().strip();
|
||||
//スキャナーの解放
|
||||
scanner.close();
|
||||
|
||||
// scanner.close();
|
||||
|
||||
System.out.println("");
|
||||
|
||||
System.out.println(defaultMessage[3]);
|
||||
System.out.println(str);
|
||||
System.out.println("");
|
||||
@@ -32,4 +34,6 @@ public class StringCheck {
|
||||
int restChar = maxChar - str.length();
|
||||
System.out.println(restChar + ":残り入力可能文字数");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user