+ 3

Array list

How can I store large data in arrays?? Like I am writing a code for student grades management system..so how can I store info(name, id, age, grades, course enrolled) of student in array list?

2nd Jul 2019, 6:10 PM
Atqa Rana
Atqa Rana - avatar
3 ответов
+ 8
Basically you need to create the student object and then you add that object with all the attributes to your list like List<Student> students = new ArrayList(); students.add(student1); If you need to handle many records, reading the students from a file or a database would be the better solution than creating them one by one.
2nd Jul 2019, 6:36 PM
Tashi N
Tashi N - avatar
+ 4
or List<Student> students = new ArrayList<>(); if you dont like warnings
2nd Jul 2019, 9:52 PM
zemiak
+ 2
Class Students { private String name; Private int age; private String grade; public Students (String name,int age, String grade){ this.name=name; this.age=age; this.grade=grade; } //get and setters. } Main { Students student0= new Students("Jack",19,"Higschool") ArrayList <Students> Class= new ArrayList(); Class.add(student0) } // I am not a expert, hope it works for someone.
12th Aug 2019, 8:32 PM
Rafael Olivar
Rafael Olivar - avatar