Syntax error on token(s), misplaced construct(s)

You need to place all statements after the declarations in a code block, e.g. method rather than the class block. Logically it probably makes sense to place all statements in the code block but the non-declarative statements need to be enclosed within the new block

private void processFile() {
    data.put("1", new Object[]{"ID","NAME", "LASTNAME"}); // <--Syntax error  
     ...//snip
  } catch (Exception e) {
     e.printStackTrace();
  } 
}

Leave a Comment