011-002-001
Constructor Call: Creating Multiple Objects
Easy
Problem Description
constructor Call: Creating Multiple Objects
In this problem, you will create a program that calls the Student class constructor with the new keyword to create two separate student objects, then displays each student's name and score to standard output.
Learning Objective: Call constructor with new keyword to create objects
Create program managing two students' information. Call Student class constructor with new keyword to create independent objects.
Input
Line 1: Student 1 name (string)
Line 2: Student 1 score (integer)
Line 3: Student 2 name (string)
Line 4: Student 2 score (integer)
Output
Student 1: [name] - [score] points
Student 2: [name] - [score] points
```java
## Examples
### Example 1: Basic values
Input:
```java
Taro
85
Hanako
92
```java
Output:
```java
Student 1: Taro - 85 points
Student 2: Hanako - 92 points
```java
### Example 2: Different values
Input:
```java
Ichiro
70
Jiro
80
```java
Output:
```java
Student 1: Ichiro - 70 points
Student 2: Jiro - 80 points
```java
### Example 3: Boundary values
Input:
```java
A
0
B
100
```java
Output:
```java
Student 1: A - 0 points
Student 2: B - 100 points
Test Cases
※ Output examples follow programming industry standards
Input:
Taro 85 Hanako 92
Expected Output:
Student 1: Taro - 85 points Student 2: Hanako - 92 points
Input:
Ichiro 70 Jiro 80
Expected Output:
Student 1: Ichiro - 70 points Student 2: Jiro - 80 points
Input:
A 0 B 100
Expected Output:
Student 1: A - 0 points Student 2: B - 100 points
Input:
Alice 90 Bob 75
Expected Output:
Student 1: Alice - 90 points Student 2: Bob - 75 points
❌ Some tests failed
Your Solution
Current Mode:● My Code
Student.java🔒
Solution.java🔒
2/6 ファイル96B
⚠️警告
- No main method found
9
1
2
3
4
›
⌄
import java.util.Scanner;
class Student {
}
0 B / 5 MB
You have 8 free executions remaining
