java - error: the left-hand side must be a variable -
eclipse giving me error "the left-hand side must variable" @ part of code:
else { for(int i=0; i>=cellphonearr.length; i++) {if (cell_1.equals2(cellphonearr[i])) system.out.println(cellphonearr[i]); else (cell_1.equals3(cellphonearr[i])); ---> error system.out.println(cellphonearr[i]); }
the method equals3 following:
public boolean equals3(cellphone phone) { if (brand.equals(phone)); }
i've been trying figure 1 out, way invoked 2 other methods equals 1 , 2 both worked object cell_1.
try as:
else { for(int i=0; i>=cellphonearr.length; i++) {if (cell_1.equals2(cellphonearr[i])) system.out.println(cellphonearr[i]); else if(cell_1.equals3(cellphonearr[i])) system.out.println(cellphonearr[i]); }
and method equals3 must return boolean values as:
public boolean equals3(cellphone phone) { if (brand.equals(phone)) return true; else return false; }
Comments
Post a Comment