[Solved] Why my Model class, data is incorrect?


The problem is about access modifiers which change the fields class behaviour .
You are making confusion with class instance variable and class variable .

Case 1 (instance variable )

public class DataMasterList {

    private String masterCode;

    public DataMasterList() {
        // TODO Auto-generated constructor stub
    }

    public  String getMasterCode() {
        return this.masterCode;
    }

    public  void setMasterCode(String masterCode) {
        this.masterCode = masterCode;
    }

private String masterCode; you can access to this field only with accessor methods and when you create a new instance , each instance will have own field.

case 2 (static variable )

public class DataMasterList {

    static String masterCode;

    public DataMasterList() {
        // TODO Auto-generated constructor stub
    }

    public static String getMasterCode() {
        return masterCode;
    }

    public static void setMasterCode(String masterCode) {
        DataMasterList.masterCode = masterCode;
    }

} 

static String masterCode; you can access to the field directly without accessor methods and without create any instance of the object . Anyway if you create instances like in your case , when you modify the last time the masterCode it willl effect all instances.

solved Why my Model class, data is incorrect?