008-005-001

Reference Type Parameter Method: Array List Display

Easy

Problem Description

Reference Type Parameter Method: Array List Display

Learning Objective: Define method with reference type (array) parameter

Create program displaying all elements with numbers from string array. Pass array to displayList method.

Input

Line 1: Number of elements (integer)
Following lines: Each element (string)

Output

1. [element1]
2. [element2]
3. [element3]
...
```java

## Examples

### Example 1: 3 fruits
Input:
```java
3
apple
banana
orange
```java
Output:
```java
1. apple
2. banana
3. orange
```java

### Example 2: 4 subjects
Input:
```java
4
math
english
science
social
```java
Output:
```java
1. math
2. english
3. science
4. social
```java

### Example 3: 1 element (boundary)
Input:
```java
1
A
```java
Output:
```java
1. A

Test Cases

※ Output examples follow programming industry standards

Input:
3
Apple
Banana
Orange
Expected Output:
1. Apple
2. Banana
3. Orange
Input:
4
Math
English
Science
Social Studies
Expected Output:
1. Math
2. English
3. Science
4. Social
Input:
1
A
Expected Output:
1. A
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here

sc.close();
}
}
0 B / 5 MB

You have 9 free executions remaining