public static void main(String[] args) { TestSection ts = new TestSection(); Section s = new Section(); String[] str = new String[] { "Jack:90:92:90:90:90", "Shazz:88:45:76:60:44", "Nazz:74:44:56:64:52" }; s = ts.makeSections(str); System.out.println(s.nameofA()); } public Section makeSections(String[] studentsData) { Section sc = new Section(); sc.student = new Student[studentsData.length]; String[] studentsDta = new String[3]; for (int i = 0; i < studentsData.length; i++) { studentsDta = studentsData[i].split(":"); sc.student[i] = new Student(); sc.student[i].name = studentsDta[0]; sc.student[i].marks = studentsDta[]; } return sc; }
sc.student[i].marks
int j; sc.student[i].marks = new int[studentDTA.length-1]; for (j = 0; j < (studentDTA.length - 1 ); j++) { sc.student[i].marks[j] = integer.parseInt(studentDTA[j+1]); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)