when overriding this method, an error is generated:

The left-hand side of an assignment must be a variable.

How to remove it?

Program code snippet:

public class AbstrTableModel extends AbstractTableModel { HashMap<Integer, Smartphone> hashMap; public static int key = 0; private File fin; private Scanner fileScanner; public AbstrTableModel(){ AbstrTableModel.key = 0; hashMap = new HashMap<Integer, Smartphone>(); } //------------------------------------- @Override public void setValueAt(Object value, int rowIndex, int columnIndex){ switch(columnIndex){ case 1: hashMap.get(rowIndex).setModel() = (String)value; return; case 2: hashMap.get(rowIndex).setRazmer() = (Double)value; return; case 3: hashMap.get(rowIndex).setTip_displeya()= (String)value; return; case 4: hashMap.get(rowIndex).setVmFlash()= (Integer)value; return; } } } 

    2 answers 2

    Error means - "on the left side of the assignment operator must be a variable."

    You cannot use the hashMap.get(rowIndex).setModel() construction on the left side of an assignment operation.
    If setModel() setter method, then it should set some value through its argument.

      Swears at the line

      hashMap.get (rowIndex) .setModel () = (String) value;

      The expression on the left must be variable.

      Try this

      hashMap.get (rowIndex) .setModel ((String) value);