-->
当前位置:首页 > 题库

PROGRAMMING:Program fill in question 1

Luz5年前 (2021-05-10)题库504
The following program is incomplete, please complete the code, the given code is correct, not allowed to modify.

import java.util.ArrayList;
public class Main{
private ArrayList slist = new ArrayList();
public void addStudent(Student s){
this.slist.add(s);
}
public void showStudent(){
for(Student s:slist){
System.out.println(s);
}
}
public static void main(String[] args) {
Main t = new Main();
t.addStudent(new Student("2016001","rose",18));
t.addStudent(new Student("2016002","hunifu",19));
t.addStudent(new Student("2016003","britsh",20));
t.addStudent(new Student("2016004","sunni",17));
t.showStudent();
}
}
class Student {
//Complete the code
}

###Input format:
nothing
###Output format:
nothing
###Input example:
```in
```
###Output example:
```out
2016001 rose 18
2016002 hunifu 19
2016003 britsh 20
2016004 sunni 17
```







answer:If there is no answer, please comment