As salamo alaikum wa rahmatullah
package collections.demo;
import java.util.ArrayList;
class Employee{
int emp_no;
String empname;
double Salary;
}
public class CustomClassArrayList {
public static void main(String[] args) {
// TODO Auto-generated method stub
ArrayList<Employee> aListEmp=new ArrayList<Employee>();
Employee e=new Employee();
e.emp_no=101;
e.empname="Mohammad Shahnawaz";
e.Salary=1200.99;
aListEmp.add(e);
e=new Employee();
e.emp_no=102;
e.empname="Arham Hanan Zamman";
e.Salary=1200.99;
aListEmp.add(e);
e=new Employee();
e.emp_no=103;
e.empname="Khadija Zamman";
e.Salary=1200.99;
aListEmp.add(e);
for(Employee e1: aListEmp) {
System.out.println("Employee no :- "+e1.emp_no);
System.out.println("Employee name :- "+e1.empname);
System.out.println("Employee salary :- "+e1.Salary);
}
}
}
jazak allah khair