My question is kinda similar to these two here;
but I'm hitting a wall with the answers provided as I only needed to print the data of the array from a method.
Here is my code:
public static void main(String[] args) {
Student[] s1 = {new Student("Karen", "male", 121, "N", 2, "e"),
new Student("K", "male", 122, "e", 3, "e"),
new Student("L", "male", 123, "", 4, ""),
new Student("M", "male", 124, "", 5, ""),
new Student("O", "female", 125, "", 1, "")};
s1.studentInfo(); //My questions involves something like this
}
where the set-up is like this
new Student(String StudentName, String Gender, int StudentNumber, String program, int YearLevel, String Orgs)
and this is the method where I want the array data to be accessible, and then prints it.
public void studentInfo(){
System.out.println("Student name: "+super.getName());
System.out.println("Gender: "+super.getGender());
System.out.println("Student number: "+super.getStudNumber());
System.out.println("Program: "+getProgram());
System.out.println("Year Level: "+getYrlevel());
System.out.println("Organization: "+getOrg());
}