 <p>This is <code>employee.getDepartment()</code> is the issue of error because the instance <code>employee</code> still null you can't <code>getDepartment</code> you need to setDepartment:</p> <pre><code> public void addEmployee(String[] list,Employee employee) { employee.setDepartment(..); ... } </code></pre>