import java.util.ArrayList;
import java.util.Random;
public class College
{
// instance variables - replace the example below with your own
private ArrayList<Student> students;
public College()
{
// initialise instance variables
ArrayList<Student> students = new ArrayList<Student>();
students.add("Student 1");
students.add("Student 2");
students.add("Student 3");
}
}
Run Code Online (Sandbox Code Playgroud)
基本上它突出显示.add显示错误消息"java.lang.IllegalArgumentException:bound必须为正",我不明白我在这里做错了什么?我在这里查看了很多这类问题,但我确实做了他们所做的