008-002-009

Object Method: Counter

Easy

Problem Description

Object method: Counter

In this problem, you will create a program that instantiates a Counter class object, calls the increment() method a specified number of times to update its count value, and displays the result to standard output.

Learning Objective: Understand methods that change state

Create Counter class object and call increment method multiple times to count. Change object state with methods.

Input

Line 1: Count times (integer)

Output

Count: [times]
```java

## Examples

### Example 1: Count 3 times
Input:
```java
3
```java
Output:
```java
Count: 3
```java

### Example 2: Count 5 times
Input:
```java
5
```java
Output:
```java
Count: 5
```java

### Example 3: 0 times (boundary)
Input:
```java
0
```java
Output:
```java
Count: 0

Test Cases

※ Output examples follow programming industry standards

Input:
3
Expected Output:
Count: 3
Input:
5
Expected Output:
Count: 5
Input:
0
Expected Output:
Count: 0
Input:
10
Expected Output:
Count: 10
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
Counter.java🔒
Solution.java🔒
2/6 ファイル96B
⚠️警告
  • No main method found
import java.util.Scanner;

class Counter {
}
0 B / 5 MB

You have 9 free executions remaining