import java.util. *;
import java.util. ArrayList;
public class Module
{
private int moduleCode;
private String classlist;
private ArrayList<String>studentsEnrol;
public Module(){
studentsEnrol = new ArrayList<String>();
}
public void storestudent(String student){
studentsEnrol.add(student);
}
public String classlist(){
return classlist();
}
This is a code i wrote, the code meant to store student in a array list, e.g. when invoke void storestudent(String student)
method it will ask me to add student name, then that student name should be store in array list so next time when i call String classlist()
the student name that are store in ArrayList should get returned.