title: Getters and setters in Java
body: <p>I am very new to <code>Java</code> and I am trying to understand some concepts. I have been reading a couple of books but I keep getting stumped around the same place. Look at the following code:</p>
  
  <pre><code>package Grade;
  import static java.lang.System.out;
  import java.util.*;
  
  public class GradeBook {
  
  private String courseName;
  
  public void setCourseName (String name) {
      courseName = name;
  
  }
  public String getCourseName() {
      return courseName;
  }
  
  public void Display() // needs a string to run
  {
  out.println("Welcome to:" + getCourseName() );  
  }
  }
  </code></pre>
  
  <p>I'm not sure why <code>setCourseName()</code> needs ( String name ) to be there or where it even gets that value from. If someone could try to explain this in layman terms it will be greatly appreciated.</p>