002-002-005
String Input: Address Input Form
Easy
Problem Description
String Input: Address Input Form
Learning Objective: Handle multi-line string input
In an address input form, input prefecture and city to display confirmation screen. Practice receiving multiple pieces of information in sequence like actual form input.
Input
Line 1: Prefecture (string)
Line 2: City (string)
Output
================================
Address Confirmation
================================
Input:
Prefecture: [prefecture]
City: [city]
================================
```java
## Examples
### Example 1: Tokyo, Shibuya
Input:
```java
Tokyo
Shibuya
```java
Output:
```java
================================
Address Confirmation
================================
Input:
Prefecture: Tokyo
City: Shibuya
================================
Test Cases
※ Output examples follow programming industry standards
Input:
Tokyo Shibuya
Expected Output:
================================ Address Confirmation ================================ Input: Prefecture: Tokyo City: Shibuya ================================
Input:
Osaka Osaka City
Expected Output:
================================ Address Confirmation ================================ Input: Prefecture: Osaka City: Osaka City ================================
Input:
Kyoto Kyoto City
Expected Output:
================================ Address Confirmation ================================ Input: Prefecture: Kyoto City: Kyoto City ================================
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
›
⌄
⌄
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
// キーボード入力を読むためのScannerオブジェクトを作成
Scanner sc = new Scanner(System.in);
// 都道府県を入力
String prefecture = sc.nextLine();
// 市区町村を入力
String city = sc.nextLine();
// 住所確認を表示
System.out.println("================================");
System.out.println(" Address Confirmation");
System.out.println("================================");
System.out.println("Input:");
System.out.println("Prefecture: " + prefecture);
System.out.println("City: " + city);
System.out.println("================================");
}
}
0 B / 5 MB
You have 10 free executions remaining
