I am using JFrame(swing) and I want to access an ArrayList created in one JFrame form into another JFrame form. I created ArrayList here
public class addEmployee extends javax.swing.JFrame {
public static ArrayList<EmployeeClass> empList;}
public addEmployee() {
initComponents();
empList = new ArrayList<>();}
I want to use it here
public class payroll extends javax.swing.JFrame {
/**
* Creates new form payroll
*/
public payroll() {
initComponents();
ArrayList<EmployeeClass> empList = addEmployee.empList;
}
It is giving me error when I try to iterate it in the second frame
for(int i = 0 ; i<empList.size() ; i++){
}