Pages

Friday, November 2, 2018

Java Coming Back to Me Slowly

ArrayList[] argList = new ArrayList();
argList.add(new ArgList("-zs", ArgValues.FLOAT));

That first line has the error "Type Mismatch: Cannot convert from ArrayList to ArrayList"

Huh?

In C this would be something like

argList[] args = [{-zs", "FLOAT}. "-ze", FLOAT}];


I was trying to do this the hard way:
ArgList[] argList = {
new ArgList("-zs", ArgValues.FLOAT),
new ArgList("-zi", ArgValues.FLOAT),
new ArgList("-ze", ArgValues.FLOAT)};

2 comments:

  1. You declared argList as an array of ArrayLists. You probably meant
    ArrayList argList = new ArrayList();

    ReplyDelete
  2. You are trying to store an ArrayList in an array of ArrayLists.

    ReplyDelete