012-001-006

Static Variable: Student ID Auto-generation

Easy

Problem Description

static variable: Student ID Auto-generation

In this problem, you will create a program that defines a static counter variable in a Student class, auto-increments it on each object instantiation to assign a unique ID, and displays the result to standard output.

Learning Objective: Auto-number with static variable

Create student management system. Use static variable to automatically assign unique ID each time new student is registered.

Input

Line 1: Student name (string)

Output

Student ID: [ID]
Name: [name]
Registered: [count] people

Test Cases

※ Output examples follow programming industry standards

Input:
Taro
Expected Output:
Student ID: 1
Name: Taro
Registered: 1 people
Input:
Hanako
Expected Output:
Student ID: 1
Name: Hanako
Registered: 1 people
Input:
A
Expected Output:
Student ID: 1
Name: A
Registered: 1 people
Input:
Bob
Expected Output:
Student ID: 1
Name: Bob
Registered: 1 people
❌ Some tests failed
❌ エラー発生

Your Solution

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

class Student {
}
0 B / 5 MB

You have 8 free executions remaining