title: Understanding Java constructor with no parameter but with class variables
body: <p>From <a href="https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html" rel="nofollow noreferrer">the java tutorial</a> I see that a class can have two different constructors with the distinction being the number of arguments provided in each constructor, they also give an example of the no constructor parameter. Based on that information and their example. I have written the class to get a better understanding. I also notice that the fields inside the no param constructor can be changed using getter and setter methods, so I do not see differences with a constructor that has parameters. I have read some question here but they don't address this.</p>
  
  <p>My question: Are there specific cases where such constructor SHOULD be used, if yes what is the reasoning behind it and are there benefits?</p>
  
  <pre><code>public class Course {
  
      int numberOfStudents;
      String courseName;
      String courseLecturer;
  
      public Course() {
          this.courseName = "Human Science";
          this.courseLecturer = "Jane Doe";
          this.numberOfStudents = 22;
      }
  
      public Course(String courseName, String courseLecturer, int numberOfStudents) {
  
          this.courseName = courseName;
          this.courseLecturer = courseLecturer;
          this.numberOfStudents = numberOfStudents;
  
      }
  
      public String getCourseName() {
  
          return this.courseName;
      } 
  
      public void setCourseName(String courseName) {
  
          courseName = this.courseName;
      } 
  
      public static void main(String[] args) {
  
          Course courseType2 = new Course("CIV4046F", "Obi", 45);
          System.out.println(courseType2.getCourseName());
  
      }
  
  }
  </code></pre>