-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayListObjects.java
More file actions
26 lines (19 loc) · 829 Bytes
/
Copy pathArrayListObjects.java
File metadata and controls
26 lines (19 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.util.ArrayList;
import java.util.Scanner;
public class ArrayListObjects {
public static void main(String[] args) {
ArrayList<Students> studentsArrayList = new ArrayList<Students>();
Students student1 = new Students("Tavneet singh", 10, 13);
Students student2 = new Students("Satya", 01, 13);
Students student3 = new Students("Sundar", 02, 13);
studentsArrayList.add(student1);
studentsArrayList.add(student2);
studentsArrayList.add(student3);
System.out.println("Entered Records are:");
int i = 1;
for (Students student : studentsArrayList) {
System.out.println(i + ") Student details are: " + "Name:" + student.Name + " Rollno.:" + student.Rollno + " Class:" + student.Classno);
i++;
}
}
}