title: Constructor or Setters?
body: <p>Well for the most of you this may be a simple question but I'm asking this to ensure that my class design isn't violating design concepts when it comes with proper use of constructor as well as access modifier. </p>
  
  <p>In this class I'm working on I didn't use setters because I thought it would be correct to initialize <strong>Subject</strong> object by using the constructor instead of setting each field using setter methods. Hence, require my other teammates to supply the attributes of class <strong>Subject</strong> when it is instantiated before calling <code>add()</code> method.</p>
  
  <p>My question is why I'm getting this warning on Netbeans?</p>
  
  <p><a href="https://i.stack.imgur.com/ENc7g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ENc7g.png" alt="enter image description here"></a></p>
  
  <ol>
  <li><p>Should I make the instance variables <code>private final</code>?</p></li>
  <li><p>Should I just remove the constructor parameters and create setter methods to initialize the fields/variables?</p></li>
  </ol>
  
  <p>Here's my code.</p>
  
  <pre><code>public class Subject {
  
      private String subjectName;
      private String subjectCode;
      private int subjectUnits;
      private String subjectDescription;
      private String subjectYearLevel;
      private int schoolYearStart;
      private int schoolYearEnd;
  
      public Subject(String name, String code, int units, String description, String yearLevel){
          subjectName = name;
          subjectCode = code;
          subjectUnits = units;
          subjectDescription = description;
          subjectYearLevel = yearLevel;
      }
  
      public void add(){
  
          String SQL = "INSERT INTO subject(name,code,units,description,yearlevel,creator) "
                  + "VALUES (?,?,?,?,?,?)";
          try(Connection con = DBUtil.getConnection(DBType.MYSQL);
                  PreparedStatement ps = con.prepareStatement(SQL);){
              ps.setString(1,subjectName );
              ps.setString(2,subjectCode );
              ps.setInt(3, subjectUnits);
              ps.setString(4, subjectDescription);
              ps.setString(5, subjectYearLevel);
              ps.setString(6, Login.getUsername());
  
          } catch (SQLException e) {
              JOptionPane.showMessageDialog(null,e.getClass()+" "+e.getMessage());
          }
      }
  }
  </code></pre>
  
  <p>I'd appreciate any advice. </p>
  
  <p>Thanks.</p>