I'm having a problem with calling arrays from a class. I know I should should separate the user interface from the logic so that's what I've tried to do. If you know of a better way please mention that too
Anyway, when ever I use an array list, it always starts with "null". The only fix I've been able to find is by chopping off the first few characters.
This is an example of which the output is:
nullname1
name2
name3
name4
name5student students = new student(); System.out.println(students.getStudent());
public class student { private String student; public String getStudent() { String[] students = {"name1","name2","name3","name4","name5"}; for (int i = 0; i < students.length; i++) { student = student + students[i] + "\n"; } return student; } }
Thanks